cURL documentation for https://smtpserver.com. Mail sending is now super easy!
Sending emails via the SMTPServer's API using cURL is straightforward. Simply create the command by adhering to the instructions provided below.
Mail sending occurs through the utilization of the POST method. The API's URL for this functionality is https://api.smtpserver.com/mailer/send.
curl -X POST https://api.smtpserver.com/mailer/sendProceed by including the headers. Two essential headers, namely App-Key and Content-Type, are required. The App-Key should contain your API key, while the Content-Type must always be set to multipart/form-data. Subsequently, you have the option to include additional headers as per your requirements.
-H "App-Key: <YOUR API KEY>"
-H "Content-Type: multipart/form-data"
-H "<CUSTOM-HERDER-1>: <VALUE>"
-H "<CUSTOM-HERDER-2>: <VALUE>"Afterward, include the to field in the form. This field is a mandatory field and is expected to comprise a JSON string where the keys represent the email IDs of the recipients and the corresponding values indicate their names. If you prefer not to provide a name, simply pass an empty string.
-F to='{"test1@test.com": "Tester 1"}'Following that, include the sender's email address, which is a required field. However, it does not include the sender's name. An alternative option is available for specifying the sender's name.
-F from=test@test.comSubsequently, you have the option to include the sender's name, if desired.
-F from_name='<SENDER NAME>'Following that, you can choose to include the email subject if desired.
-F subject='<SUBJECT>'Subsequently, provide the HTML content for the email body. Alternatively, you can provide the Text version of the body. It is mandatory to pass one of these options.
-F text='<TEXT BODY>'
-F html='<HTML BODY>'In conclusion, you have the choice to include attachments with your email. This step is optional.
-F attachment_1=@<ABSOLUTE PATH TO FILE>
-F attachment_2=@<ABSOLUTE PATH TO FILE>This project is used by SMTPServer:
