Sendgrid - SMTP or CURL?

We are setting up a mass mailing system using sendgrid as our core.

We manage lists ourselves, and sendgrid is just our transport, and an igniter code is used to create the system.

We are interested in what you would recommend using sendgrid as an smtp server or using its curl API.

Every day we send emails to x00,000 people, all letters have the same content.

We found SendGrid integration documentation for a code igniter that only contains smtp examples, maybe this is the way to go?

Another part of the question is, if we have to go with SMTP-api, how does the igniters bcc_batch_mode code work?

+6
source share
3 answers

Reading the documentation at http://sendgrid.com/documentation/map/version/v2#api there is little choice between them. All functionality is available anyway. For PHP, I recommend that the SMTP server with their SMTP API use existing libraries that correctly format, mime-encode, and send email. Notably, the sample PHP code is provided only for the SMTP API.

Edited to add to the question

The sendgrid documentation says that CC and BCC are not used to encode multiple recipients of their APIs in a custom mail header - X-SMTPAPI. See http://sendgrid.com/documentation/display/api/SMTPDevelopersGuide

The http://sendgrid.com/documentation/display/api/SMTP best practices section for multi-recipient releases in regular mail headers.

+7
source

I am currently working in SendGrid. Our web API is actually faster than SMTP, since you only need to make one cURL request to send a message, while with SMTP there are many TCP reverse requests for connection, HELO, etc.

We recently published a new PHP library, you can find it in our github account: http://github.com/sendgrid/

Feel free to contact us if you have any questions.

+10
source

Ok, just as a link for everyone Iโ€™m going to embed in my support chat. Please note that this chat covers a wide range of things, so it may be useful to keep it here.

me: sending to multiple recipients using a code igniter? Hi, I'm a php developer using a code igniter, we use sendgrid as an email sending platform,

Support : Hello.


me : hello

Support . Let me see if I can find the link in our docs.

me : I think you're about to link: http://bit.ly/jL1Pde

Support . This was the one I was looking for.
me : Yes, I saw it, but I also saw http://bit.ly/jvowuk that says you should use the X- SMTPAPI Header, so I'm a little confused about what I should use?

Support . Use the Codeigniter example from the previous link. You can use X-SMTPAPI, but in this case it is not needed. The reason is better portability with other languages.
me : Oh, I see, thank you very much, I have one more request.
Support : Good.

me . When sending emails, is there any header that we can send to associate additional information with e-mail (for example, an identifier from our system) to help in the search?

Support . If necessary, you can set a custom category. setCategory (cat) Sets the category so that the email is registered as. You can use any category name that you like. This is from http://bit.ly/iYjq2G

me : Oh, I see, thanks, and I'm sorry that I'm afraid, but I have one more question,

Support : Good.

me . We want to give our users the opportunity to unsubscribe from receiving emails. All emails sent through a certain group (for example, 100,000 letters) will have the same content, except that we want to add a message about unsubscribing below, we want to track the unsubscription of a specific message sent from our system, so we want the url to look like http://example.com/unsubscribe/1234 , 1234 is the unique identifier of the sent message, does sendgrid make it easy to complete this, or should we make an individual request for each message?

Support . So, you can do this using: addFilterSetting (filter, setting, val) Adds / modifies the filter setting. The parameters specified in the header override the configured parameters. The following is an example of a parameter that is included in PHP: $ hdr-> addFilterSetting ('subscriptiontrack', 'enable', 1);
me : ok, so see http://bit.ly/k49a57 for your username to appear in the link, what exactly does that mean? since we donโ€™t want the user to be sent to sendgrid to unsubscribe.

Support . Thus, this allows you to link to something else other than what we provide, for example, "Remove yourself from this company."
me : Oh, I see. Therefore, if we want the URL to be something personal, we have to deal with it ourselves, thatโ€™s fine, I canโ€™t remember where, but I noticed that there was something about email lookups somewhere content, this will allow us to send a list of identifiers to our mailbox, could we have * example.com/unsubscribe/- email_id - * and replace it * - email_id - * with the passed identifier?

me : Ah, http://bit.ly/jvowuk point 2 is what I was talking about, can I use this?

Support . Yes, you could do it.
me : ah, here is the best example, http://bit.ly/lK6ltE

Support . Yes, it shows a replacement email. Thus, it can be changed for everyone.

me : So, I can use * $ this-> email โ†’ _ set_header ('Custom-Header', 'value'); * in the code igniter to set a custom header, if I sent, say 3000 emails, I have an array that looks like an array (5,6,7,8 ...) with identifiers, 3000 of them. How would I send them? (if this is not a quick answer, I can handle this by looking at the SmtpApiHeader class)

Support : SmtpApiHeader is the best way. Adding them as parameters for replacement. Each indexed identifier.
The session is disconnected.
+2
source

Source: https://habr.com/ru/post/889493/


All Articles