Sendgrid - SMTP 还是 CURL?

发布于 2024-11-10 11:06:12 字数 467 浏览 1 评论 0 原文

我们正在建立一个以 sendgrid 为核心的批量邮件系统。

我们自己管理列表,sendgrid 只是我们的传输工具,并使用代码点火器来构建系统。

我们想知道您会建议我们使用什么,sendgrid 作为 smtp 服务器,还是使用它的curl API。

我们每天向 x00,000 人发送电子邮件,这些电子邮件的内容都相同。

我们找到了 SendGrid 的 code igniter 集成文档< /a> 其中只有 smtp 示例,所以可能这就是要走的路吗?

问题的另一部分是,如果我们使用 SMTP api,代码点火器 bcc_batch_mode 如何工作?

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

We are managing the lists ourselves and sendgrid is simply our transport and are using code igniter to build the system.

We are wondering what you would recommend we use, sendgrid as an smtp server, or use it's curl API.

We are sending emails out to x00,000 people every day, the emails all have the same content.

We have found SendGrid's integration documentation for code igniter which only has smtp examples, so possibly that is the way to go?

The other part of the question is, if we were to go with the SMTP api, how does code igniters bcc_batch_mode work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小…红帽 2024-11-17 11:06:12

我目前在 SendGrid 工作。我们的 Web API 实际上比 SMTP 运行得更快,因为您只需要向我们发出一个 cURL 请求即可发送消息,而使用 SMTP 则需要大量来回的 TCP 连接、HELO 等操作。

我们最近发布了一个新的 PHP 库,您可以在我们的 github 帐户上找到它: http://github.com/sendgrid/< /a>

如果您有任何疑问,请随时与我们联系。

I currently work at SendGrid. Our web API actually works faster than SMTP, as you only need to make a single cURL request to us to send a message, whereas with SMTP there's a lot of back-and-forth TCP chatter for connection, HELO, and such.

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

Don't hesitate to contact us if you have questions.

漆黑的白昼 2024-11-17 11:06:12

阅读文档 http://sendgrid.com/documentation/map/version/v2#api
它们之间几乎没有什么可供选择的。无论哪种方式,所有功能都可用。对于 PHP,我建议使用 smtp 服务器及其 SMTP API,以利用现有的库来正确格式化、mime 编码和发送电子邮件。值得注意的是,示例 PHP 代码仅针对 SMTP API 给出。

编辑问题的补充

sendgrid 文档说要在自定义邮件标头中使用 API 对多个收件人进行编码 - X-SMTPAPI - 不使用 CC 和 BCC。请参阅 http://sendgrid.com/documentation/display/api/SMTPDevelopersGuide

http://sendgrid.com/documentation/display/api/SMTP 针对多个问题的最佳实践部分常规邮件标头中的收件人。

Reading the documentation at http://sendgrid.com/documentation/map/version/v2#api
there is little to choose between them. All functionality is available either way. For PHP, I recommend smtp server with their SMTP API to take advantage of existing libraries that correctly format, mime encode, and send the email. Notably, example PHP code is given only for the SMTP API.

Edited for additions to question

The sendgrid documentation say to encode multiple recipients with their API in a custom mail header -- X-SMTPAPI --not using CC and BCC. See http://sendgrid.com/documentation/display/api/SMTPDevelopersGuide

http://sendgrid.com/documentation/display/api/SMTP best practices section for issue with multiple recipients in the regular mail headers.

瘫痪情歌 2024-11-17 11:06:12

好的,为了给大家提供参考,我将粘贴我的支持聊天内容。请注意,此聊天涵盖了广泛的内容,因此将其存储在这里可能会很有用

:使用代码点火器发送给多个收件人?
您好,我是一名使用 code igniter 的 php 开发人员,我们使用 sendgrid 作为我们的电子邮件发送平台,

支持:您好。

<小时>
:嗨,
<小时>
支持:让我看看是否可以在我们的文档中找到参考。
<小时>
:我相信您会参考:http://bit.ly/jL1Pde
<小时>
支持:这就是我一直在寻找的。
<小时>
:是的,我已经看到了,但我也看到了http://bit.ly/jvowuk 表示您应该使用 X-SMTPAPI 标头,所以我对应该使用哪个感到有点困惑?
<小时>
支持:使用上一个链接中的 Codeigniter 示例。您可以使用X-SMTPAPI,但在本例中不需要。原因是为了与其他语言更好的可移植性。
<小时>
:哦,我明白了,非常感谢,我还有一个问题。
<小时>
支持:好的。
<小时>
:发送电子邮件时,我们是否可以发送任何标头来将额外信息与电子邮件关联起来(例如我们系统中的 ID)以帮助查找?
<小时>
支持:如果需要,您可以设置自定义类别。 setCategory(cat) 设置要记录的电子邮件的类别。您可以使用任何您喜欢的类别名称。这是来自 http://bit.ly/iYjq2G
<小时>
:哦,我明白了,谢谢,很抱歉让您感到痛苦,但我还有一个问题,
<小时>
支持:好的。
<小时>
:我们希望为用户提供取消订阅接收电子邮件的功能,特定批次(例如 100,000 封电子邮件)中发送的所有电子邮件都将具有完全相同的内容,但我们希望的例外情况除外要将取消订阅消息附加到底部,我们希望能够将取消订阅跟踪回从我们的系统发送的特定消息,因此我们希望 url 看起来像 http://example.com/unsubscribe/1234,1234 是发送消息的唯一 ID,sendgrid 是否提供了一种简单的方法来完成此操作,或者必须我们对每条消息都提出单独的请求?
<小时>
支持:好的,您可以使用以下方法执行此操作:addFilterSetting(filter, setting, val) 添加/更改过滤器的设置。标头中指定的设置将覆盖配置的设置。以下是在 PHP 中启用参数的示例:$hdr->addFilterSetting('subscriptiontrack', 'enable', 1);
<小时>
:好的,看看http://bit.ly/k49a57,它说的是您的自定义名称出现在链接中,这到底是什么意思?因为我们不希望用户被发送到 sendgrid 来取消订阅。
<小时>
支持:因此,它允许您让链接显示与我们提供的内容不同的内容,例如“将我自己从这家公司中删除”。
<小时>
:哦,我明白了,所以如果我们希望网址是个人的,我们必须自己管理它,这很好,我不记得在哪里,但我注意到某处有一些关于电子邮件替换的内容内容,这是否允许我们发送 ids 列表,并且在我们的电子邮件正文中我们可以有 *example.com/unsubscribe/--email_id--* 并让它用传递的 id 替换 *--email_id--* ?
<小时>
:啊,http://bit.ly/jvowuk第2点就是我的意思指的是,我可以使用它吗?
<小时>
支持:是的,你可以这样做。
<小时>
:啊,这是一个更好的例子,http://bit.ly/lK6ltE
<小时>
支持:是的,这会显示带有替换的电子邮件。因此,可以针对每个进行修改。
<小时>
:所以,我可以在代码点火器中使用 *$this->email->_set_header('Custom-Header', 'value');* 来设置自定义标头,如果我是发送 3000 封电子邮件,我有一个看起来像 array(5,6,7,8...) 的数组,其中包含 3000 个 ID,我将如何发送这些邮件? (如果这不是一个快速答案,我可以通过查看 SmtpApiHeader 类来解决)
<小时>
支持SmtpApiHeader是最好的方法。将它们添加为替换的参数。每个索引 ID。
<小时>
会话已断开。

Ok, so simply as a reference for anyone I am going to paste my support chat. Note that this chat covers a wide range of things so could be useful to have it stored here

me: Sending to multiple recipients using code igniter?
Hi there, I am a php developer using code igniter, we are using sendgrid as our email sending platform,

Support: Hello.


me: Hi,


Support: Let me see if I can find a reference in our docs.


me: I believe you are going to reference: http://bit.ly/jL1Pde


Support: That was the one I was looking for.


me: Yes, I have seen that, But I also saw http://bit.ly/jvowuk which says you should use the X-SMTPAPI header, so I am a bit confused as to which I should use?


Support: Use the Codeigniter example from the previous link. You could use X-SMTPAPI, but is not needed in this case. The reason is for better portability with other languages.


me: Oh I see, Thank you very much, I have one other query.


Support: Ok.


me: When sending emails is there any header we can send to associate extra information with an email (for example a id from our system) to help with the lookup?


Support: You can set a custom category if needed. setCategory(cat) Sets a category for an e-mail to be logged as. You can use any category name you like. This is from http://bit.ly/iYjq2G


me: Oh I see, thank you, and sorry to be a pain but I have one more question,


Support: Ok.


me: We wish to provide our users with the ability to unsubscribe from receiving emails, All emails send through in a specific batch (e.g. 100,000 emails) will have the exact same content, with the exception that we want to append an unsubscribe message to the bottom, We want to be able to track the unsubscribe back to a specific message sent from our system, so we will want to have the url look something like http://example.com/unsubscribe/1234, 1234 being the unique id for the message sent, does sendgrid provide an easy way to complete this, or must we do an individual request for every message?


Support: Ok, so you can do this using: addFilterSetting(filter, setting, val) Adds/changes a setting for a filter. Settings specified in the header will override configured settings. Here is an example of the parameter being enabled in PHP: $hdr->addFilterSetting('subscriptiontrack', 'enable', 1);


me: ok so looking at http://bit.ly/k49a57 it says about your custom name to appear in the link, what exactly does this mean? as we do not wish the user to be sent to sendgrid to unsubscribe.


Support: So, it allows you to make the link say something different other than what we provide such as 'Remove myself from this company' for example.


me: Oh I see, So if we wish the url to be something personal we must manage this ourselves, this is fine, I cant remember where, but I noticed somewhere there was something about substitutions for the email content, would this allow us to send through a list of ids and in our email body we could have *example.com/unsubscribe/--email_id--* and have it replace the *--email_id--* with the passed id?


me: Ah, http://bit.ly/jvowuk point 2 is what I was referring to, could I use that?


Support: Yes you could do that.


me: ah, here is a better example, http://bit.ly/lK6ltE


Support: Yes, that shows the e-mail with substitution. So, it can be modified for each.


me: So, I can use *$this->email->_set_header('Custom-Header', 'value');* in code igniter to set a custom header, if I was sending out say 3000 emails, I have an array that looks like array(5,6,7,8...) with the ids, 3000 of them How would I send these through? (if it is not a quick answer I can work it out by looking in the SmtpApiHeader class)


Support: The SmtpApiHeader is the best way. Adding them as parameters for the substitution. Each indexed ID.


session disconnected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文