문제

I'm using the Sendgrid Python library, and I'd like to send emails with multiple people in the 'reply_to' field.

I'd like to send an email to 2 people such that both users can email one another by hitting reply. The simplest solution to this seems to be to put both users in the reply to field.

I haven't seen any way to do this in the Sendgrid docs -- they seem to only want a single email address string in their 'reply_to' field. However, I know that emails with this characteristic are possible (please excuse the budget redaction job):

Multiple entries in the reply-to field

Anyway, as you can see, multiple entries in 'reply-to' are possible. So does anyone know how to do it with Sendgrid?

도움이 되었습니까?

해결책

Yes that is possible to do with SendGrid. To add multiple 'reply-to' entries you have to use custom headers.

So in Python, you would add:

message.add_header("Reply-To", "user1@email.com, user2@email.com")

다른 팁

As of today, there is no way to set multiple reply-to addresses. Here is the Github issue for sendgrid: https://github.com/sendgrid/sendgrid-csharp/issues/339

This has been discussed as most wanted functionality as per this open issue. Now SendGrid supports to mention multiple emails in replyTo but they introduced a new header for this as mentioned in their doc. Though this support is not available in many of their SDKs. UPDATE: Now this feature is available with Sendgrid Mail nodejs library.

So I forked their code and did the changes. The changes are available on this link and soon I will raise a PR to merge this with their code base.

The send an email with multiple emails in replyTo, use the code snippet given below:

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: 'recipient@example.org',
  from: 'sender@example.org',
  subject: 'Multiple mail in replyTo',
  html: '<p>Here’s an example of multiple replyTo email for you!</p>',
  replyToList: [
        {
            'name': 'Test User1',
            'email': 'test_user1@example.org'
        },
        {
            'email': 'test_user2@example.org'
        }
    ],
};

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top