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.
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
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'
Related
I'm working on a chatbot for Slack in AWS Lex, and I need it to collect an email address. While testing in Lex, it works fine because any email address remains as a string. But when it's hooked up to Slack, email address gets converted to mailto:youremail#domain.com format, so Lex fails to recognize it as a valid email address.
Is there any workaround to disable this functionality in Slack?
You can either do the pre-processing of the text received and extract the email address before passing it onto Lex.
Or if you are using Slack api's for sending messages then you can try to set the parse=none to disable the message formatting done by Slack. Message Formatting Api.
You will probably need to write a function to extract the email address from the returned Slack message - check out errbot's sanitize_uris function, which does exactly this.
A similar question
I'm currently trying to integrate Mailgun to send mails in batch. To test the batch sending, I decided to use a list of 10 email aliases to my own address, using a "+" alias.
For example, I'd use a list like this:
myaddress+1#gmail.com
myaddress+2#gmail.com
myaddress+3#gmail.com
etc.
To call mailgun, I'm only using a POST http call, reproducing the curl example from the Mailgun documentation.
The problem is that when I use aliases, I only receive the email once, on a random alias (e.g. myaddress+3#gmail.com). In Mailgun's logs, all the 10 emails appear as delivered.
Is this problem coming from Gmail which would filter similar mails arriving at once ? Has anyone encountered this type of problem before ?
When I add a different address (not an alias), the latter seems to receive the email correctly, but I'd like to understand why the email couldn't be sent several times to the same address.
Say I've an email id xxx#gmail.com and I get a new mail, I want to send that new mail received instantly to multiple people say yyy#gmail.com , zzz#gmail.com, etc. Is there any script or something that I could use?
http://techietalkz.com/2011/12/07/how-to-auto-forward-incoming-emails-in-gmail-to-multiple-recipients/
and
https://webapps.stackexchange.com/questions/50372/auto-forwarding-emails-to-2-email-addresses
I think you'll need to login to the forwarding e-mail addresses in order to verify you're not just sending out unwanted spam, though.
I'd like to send email to third parties on behalf of users. The key is for the user's email to show up as the "from:" email.
I've tried using send_mail with the user's email as the from_email, but to no avail. When I used gmail's servers to send the message, the third party sees the EMAIL_HOST_USER as the "from:" email. And when I tried using namecheap's mail server, I got SMTPRecipientsRefused: {u'<to email>': (553, '5.7.1 <from email>: Sender address rejected: not owned by user <EMAIL_HOST_USER>')}.
If possible, I'd like to avoid asking for their password as well.
Short answer: You can't do that.
Back in the old days, mail servers used to be quite relaxed about posting mail whenever anyone asked them to, but then SPAM happened and people realised that it was actually quite important to check that the person sending an email is actually the person whose address appears in the From: header.
There are now several mechanisms in place that make it very difficult to spoof a sender email address. These include:
Sender Policy Framework (SPF): An email validation system that works by placing restrictions on the IP addresses authorised to send email from a particular email address. If you try sending email from an IP address not associated with the legitimate owner of an email address, your mail will be rejected.
DomainKeys Identified Mail (DKIM): A method for confirming that emails claiming to have originated from a particular mail server really did originate from that server.
Mail transfer agent restrictions: These days, most MTAs are configured to only accept emails from people who it already knows. (This is why you're seeing a Sender address rejected: not owned by user error message).
Instead, your best option — essentially your only option — is to put your own email address in the From: header, and send the email from your own mail server. If you want the reply to go to someone else, add a Reply-To: header containing their email address.
If you are using Exchange, you might be able to use a library such as Exchangelib, in which the author seems to have been inspired by some of Django's design decisions. Unfortunately, it does look like you will still need to ask for the user's password. I'm going to be looking into this further later on, and since I use LDAP authentication to the Django project, perhaps there is some way to use that to authenticate to the email server, but I have my skepticism.
See this question:
https://serverfault.com/questions/546255/sending-email-with-python-django-through-microsoft-exchange-imap
Is it possible to detect for incoming mails, if they belong a to preceding e-mail conversation?
If the message has been replied to using a Microsoft email client it should have the PidTagInReplyToId property set with the id of the message replied to. This will enable you to build up a message chain from each reply to the source email.
Otherwise you'll have to rely on the "Re:" prefix in subjects and common subject names. You could also do something clever regarding who has been sent an email (in case of common subjects) or utilising the previous message body in the new email - though that obviously cannot be relied upon.