What is the maximum number of SMTP threads I can use for sending email with mailgun - mailgun

I want to send many emails using Atom Park email software using mailgun
I want to know what is the maximum amount of threads I can set in the SMTP server settings for mailgun

Related

How can I allow users to send emails through my django app but coming from their own gmail account?

I have a django app where users can send emails through the app to contacts that they upload themselves. I use Sendgrid to send the email and the recipient receives an email from a "white-label" address like hello#mydomain.com
Now, I would like to implement a system where I can allow users to send emails through our app but that those emails are sent by their own email address. To make it simple, let's just consider "Gmail" and if a user want they can "login with their gmail account" on my app and then send emails from my app that are sent from their account... I know that Gmail has an API and I wonder if I can leverage it to do what I need.
You can definitely send emails using Gmail API methods but keep in mind the below stated in their official documentation:
Note: The Gmail API shouldn't be used to replace IMAP for developing a
full-fledged email client. Instead, see IMAP, POP, and SMTP.
As they recommend, you could integrate IMAP/SMTP features in your application so users can authenticate/provide access to their accounts and achieve your goal of having emails sent from their accounts.

Multiple MX Records

We have a site on Google Cloud, let's call it 'main.co.uk'
and a subdomain site called 'forum'.
We are using Gmail business for main.co.uk emails, verified by MX records, SPF etc
Now what's confusing me is using mailgun for sending mail for 'forum'.
I know we can have multiple MX Records for main.co.uk but is there a good way to do this? do we set different priorities? Will we get issues with mailgun and Google trying to handle incoming mail?
Any advice would be great.
Using mailgun for sending emails does not involve MX records. Services like mailgun will use credentials for one of your email servers and will act like an email client program. Mailgun will authenticate and then upload email to the email server. There is also the option for programs like mailgun to act as an SMTP server for your domain (you can have more than one sending server).
Mailgun can also be configured as an email server for receiving email. However, you do not replace your existing email server, instead you create a subdomain that is then managed by mailgun. In this use case all incoming emails for that subdomain someone#mailgun.example.com are then processed by mailgun. This is similar to having multiple email accounts that you need to login into to read your email. The intent here is for mailgun to apply intelligence to the sending and processing of your email campaigns by managing email bounces, click throughs, etc.
MX records specify the mail server responsible for accepting email. You can have multiple MX records with different priorities but they are pointing to the same email system (collection of servers storing your inbox), not to different servers at different providers. For example, you would not have one MX record point to Gmail and another MX record pointing to Office 365 (or mailgun and Google). Multiple MX records support fault tolerance and failover, not multiple providers.
You can have an email server setup for main.co.uk and another email server setup for forum.main.co.uk but these are separate email server setups (I am ignoring email aliasing). You can have mailgun send email for someone#forum.main.co.uk with a return address anotherperson#main.co.uk. Normally you want to keep the sender address and return address the same so that SPAM filters don't kick in.
In summary, use mailgun to send emails from your website and / or email marketing campaigns and a normal email system (Office 365, Gmail, etc.) for everything else but have them setup as separate independent email systems.

How to make sure email is not received in spam when sent with Django EmailMessage class?

I have the following settings in my settings.py file.
EMAIL_HOST = 'mail.domain.com'
EMAIL_HOST_USER = 'me#domain.com'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
A user in my Django application is able to send an email to a client with a PDF attachment using the EmailMessage class. Here is the code:
email = EmailMessage()
email.subject = 'Demo subject'
email.body = self.request.GET.get('email_body', '')
email.from_email = 'Full Name <user#domain.com>'
email.to = ['{}'.format(self.request.GET.get('to_address'))]
email.attach_file(os.path.join(settings.MEDIA_ROOT, 'quotation_email.pdf'))
email.send()
My questions are,
Since I can create a code to send the email as a different person, will the email not be marked as spam in certain domains?
I have access to a mail server which is already setup. Can I map the email accounts to the user accounts in the Django application in such a way that Django uses the email server as a medium to send email based on the logged in users?
Why do I need to provide an email and password in settings.py file when I may never use that email account to send any mail? Can I not log in to the email every time someone sends an email?
Since I can create a code to send the email as a different person, will the email not be marked as spam in certain domains?
The domain part of the email (part after #) is what mostly determines if the email will end up as spam or not (there are, of course, other conditions in determination of spam such as IP reputation of the sending mail server i.e. was this IP used for sending spam in the past, etc).
If you are the authorised sender for a particular domain, you can send emails like john#domain.com or no-reply#domain.com without worrying.
Read about SPF and DKIM records about domain authorisation. It's a topic that I can't really cover in an answer.
I have access to a mail server which is already setup. Can I map the email accounts to the user accounts in the Django application in such a way that Django uses the email server as a medium to send email based on the logged in users?
Yes, you can if you own the email's domain name. Just get the user's email address and use it as the From address to send the email.
Why do I need to provide an email and password in settings.py file when I may never use that email account to send any mail? Can I not log in to the email every time someone sends an email?
Are you referring to the EMAIL_HOST_USER? This is for authentication purpose. This email is required to log into your SMTP server. Without this, the SMTP server will not know if you are the owner of the server or a spammer trying to use their server to send spam.
But if the SMTP server is running locally, you can just use localhost as the EMAIL_HOST and leave out the authentication. Because most email servers (MTAs) relay emails from local host without requiring authentication. But this also depends on the configuration.
Basic understanding of how emails are sent:
Emails are sent just like the real mail - inside an envelope. The envelope and the letter inside it can have different From addresses. And that is also true in case of emails.
Here's an illustrative example. Suppose you own a PO Box. If you want to send a letter to your friend, you'll do this:
Write your message on a paper. You'll sign the letter.
Buy an envelope. Write To address of your friend on the envelope.
Write the From address of your PO Box on the envelope. You don't write your own address, because if the mail couldn't be delivered, it will be returned back to your PO box.
Send out the letter.
Pretty, simple. Suppose someone in your family also wants to send out a letter to someone they know. But they don't own an PO Box. They'd have to spend some money and time to get a PO Box. But why bother, because you already have one. This is how that will work:
They'll write the message on a paper. They'll sign the letter in their own name.
Buy an envelope. Write the the To address of their friend.
Write the From address of your PO Box, so that the mail could be returned to your PO Box if it didn't deliver.
Send the letter out.
This is how actual emails work.
An SMTP server is like a Post Office.
Your email account is like a PO Box.
Every message you send, goes inside an envelope.
The sender address on the envelope can be different than the sender
address on the message inside.
I think Django uses the EMAIL_HOST_USER settings to compose the email envelope and the from_email address you provide is used as the From address.
The sender address on the envelope in known as MAIL FROM address or the Return-Path address. This is not shown to the receiving user. The From address that you see in your Gmail, or Yahoo Mail, is called the MIME From address. They both can be different.
The case is not you sender gmail.
but you need to remove all links inside your html template

Not receiving emails, but Mailgun shows 100% delivery rate

I'm using a CMS to send emails when a form is submitted. Its configured to use smtp.mailgun.org:587 with the username postmaster#domain.com. I'm using Google Apps for my email, so in this case the email account I'm receiving emails at is support#domain.com. Customers fill out a form and enter their email address is used as the "from" address and the "to" address is support#domain.com. I don't see anything in my Junk folder in Gmail. Mailgun is getting all the emails and marking them as sent/received, but I simply am not getting the emails in Gmail, thus not getting support emails from my customers. What gives?
Issue was I had mxa.mailgun.org and mxb.mailgun.org added in my MX Records on my host (Linode). Removing those records fixed the issue.

cfmail, google mail and reply to

I am having problems with google mail with a coldfusion webform, when the form gets sent the reply address is always myemail#myemail.com (substituted). Is this a google mail thing or is there a fix?
<cfmail
from = "#email#"
To = "myemail#myemail.com"
failto="#email#"
server="smtp.gmail.com"
replyto="#email#"
port="465"
useSSL="true"
username="myemail#myemail.com"
password="*****"
Subject = "Confirmation Form"
>
<cfmailparam name="Reply-To" value="#email#">
I don't believe Google Mail allows you to send mail from an address not tied to the account.
I would suggest, regardless of the SMTP server you use, using a real address tied to that domain for the "from" attribute. Set the reply-to and on-behalf-of (I think I got that right) headers to the email of the person "sending" the message.
I will give you one warning about sending lots of automated mail through Google. I was working on a project, and was told to use Google mail to send out a large amount of email. After about a day, they stopped sending out any mail on that account.... but accepted the mail. That is, their SMTP server told CF that the mail had been accepted, then trashed it instead of sending. I'd strongly suggest running your own SMTP server if you send more than a couple dozen emails a day.
I can't remember about personal accounts, but sending mail through Google Apps definitely allows customized Reply To, and this works with replyto attribute of cfmail -- without cfmailparam. Possibly it is the way to handle this problem.