1

When I'm sending email via mailgun, must I specify a 'to' recipient?

In some cases, I'd prefer to specify only 'Bcc' recipients.


EDIT: I've already tried to do this on my own and I receive a

'Bad Request - 'to' parameter is missing' error.

I just wanted to know if there's another way around this, because typically you can send an email without a 'To' recipient, so long as you specify a CC or Bcc recipient.

Jim G.
  • 15,141
  • 22
  • 103
  • 166
  • 1
    then it's probably an api restriction. use yourself as the To:, or a dedicated junk address which just dumps the mail to /dev/null. – Marc B Dec 21 '15 at 16:46
  • Related: http://stackoverflow.com/q/28503099/109941 – Jim G. Dec 21 '15 at 16:47

2 Answers2

3

You may not send mail only using bcc. There is a trick I use in which I make the from and to the same address (something like info@mydomain.com) and then fill up the bcc slot with whatever I need.

You may send mail using mailing lists that does not require you to expose other email addresses.

https://documentation.mailgun.com/en/latest/api-mailinglists.html

Nathaniel Johnson
  • 4,731
  • 1
  • 42
  • 69
  • Can we specify an empty mailing list? Because if I am sending mails in 10 batches, the mail address in to will get the mail 10 times... So, to avoid that, it is a good alternative? – thewebjackal Sep 11 '19 at 12:43
  • @ptmdevncoder You may not specify an empty `to` which is why you use your own email as a `to` email. This way it doesn't matter how many emails go to the dummy email. – Nathaniel Johnson Sep 11 '19 at 23:23
  • I did not say an empty TO. I meant to say, adding a valid mailing list created at mailgun end but with 0 entries in it. Making it an empty mailing list. But, the TO field won't be empty due to the presence of that empty mailing list. – thewebjackal Sep 12 '19 at 05:38
0

Eventually, the SMTP call is being translated to a call to the SMTP provided which is usually not forced to have a 'to' recipient, but the best way is to perform a test where you send an email with only 'bcc' recipient (you can send it to yourself as a test'

yorammi
  • 6,272
  • 1
  • 28
  • 34
  • 1
    OK. Another workaround (beside the mailing list option) is to have the sender email address also in the 'to' list. – yorammi Dec 21 '15 at 16:56