Use mailgun to send from existing domain - email

Last week I tried to configure our application to send mails using mailgun. I added the txt and cname records for mg.mydomain.com.
But what I actually want is to send on behalf on an email like user#mydomain.com and not the mg.mydomain.com subdomain.
So I changed the 'From' address to user#mydomain.com. After a while I noticed 5% of my mail got bounced back because of some spam filter. Probably because there weren't any MX records on the mg.mydomain.com domain.
The user#mydomain.com is used by outlook 365. All mail send to us should be delivered at the outlook 365 server, not mailgun.
So the perfect situation for me would be to:
Send from outlook 365 as user#mydomain.com.
Send from mailgun as user#mydomain.com
Receive at outlook 365 (like it is set up right now)
What I'm afraid of is when I'm sending an email from mailgun it still won't get through the spamfilters because the outgoing server (mailgun) is different from the server my MX record points to (outlook 365).
Could anyone confirm this or is this not a problem when setting up extra txt and cname records for mydomain.com?

You probably use DNS to set up a TXT record in which you state which servers your mail is allowed to come from. (SPF-record). Does this include both the Mailgun servers, and the Office 365 servers?
You probably also set up DKIM to sign the outgoing e-mails. Mailgun automatically signs the e-mails it sends using the DKIM setup. I'm not sure about Office 365. Perhaps the e-mail is being rejected because Office 365 does not sign your e-mails, or perhaps Mailgun and Office 365 both sign the e-mails using different private keys (this is likely), but only one of them has a public key defined in the DNS server (don't know, could be).
As long as you don't set your MX records to something done by Mailgun, you can receive all you want.

Related

sending email to office 365 email using smtp

I have a contact form built with Laravel, and I want to send an email to my company email which is hosted from office 365 and my website hosting is Cloudflare
this is the env file configuration
MAIL_MAILER=smtp
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.mail.yahoo.com
MAIL_PORT=465
MAIL_USERNAME=xxxxxxxxxx#yahoo.com
MAIL_PASSWORD=xxxxxxxxxx
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=mxxxxxxxxxx#yahoo.com
when I send an email using a contact form the email never receives to company email and when I try another receiver like yahoo or Gmail the message is delivered fine.
do any one know why i can't receive emails in my company email.
I have tried mailtrap testing and every thing was fine
I have fixed the problem, Cloudflare needs to add records to the domain to be authenticated by office 365
https://community.cloudflare.com/t/need-help-with-office-365-error/80501/4

How does an SMTP server resolve ambiguity?

Suppose I own an email 'demo#gmail.com'. Now, I create a new Microsoft account using my existing email. Thus I get another email 'demo#gmail.com', but this one is served by Microsoft.
So the situation is: one email and two providers.
If I send a hello email to 'demo#gmail.com' using my personal SMTP server, to which of the above will it send: will it send to the one hosted by Microsoft or the one hosted by Google?
How does it solve such an ambiguity? What are the factors that influence this?
This is a very common problem because many providers are giving us an option to create a new account using our existing email.
My observations:
I saw the emails inside the inboxes of both the services. I found that they had completely different emails.
There was no email which was common to both the inboxes. So there must be some mechanism to deal with it.
Let us look at the problem the other way round: If I had an email 'demo#outlook.com' initially and I created a new Google Account with this email address, then:
An email sent to this email address from another gmail account goes to the Google's server. An email sent to this email address from an Outlook also goes to the Google's servers.
There are two different ways of looking up an email. The 'normal' way:
You send an email to an server, in this example gmail.com.
Your mail delivery agent looks for mx record of gmail.comand send it to the ip-address of gmail.com.
If an email is delivered locally by the domain outlook.com it perhaps doesn't lookup the mx record, but lookups in a local database if the email-address exist there, and sends it to the ip-address of the outlook.com.
I think in the inbox of outlook.com are only microsoft emails.
More details can be found at https://www.socketlabs.com/blog/smtp-email-delivery/

How does GMail let users use their own custom email

I was trying to sign up for a new Gmail address and noticed that Gmail has an option in which you can use your custom email address without the need for having a GSuit paid membership.
Upon filling up the details, Gmail sends an OTP/code to the custom email and upon entering the right code the user can log in using that email.
How is it possible for Gmail to just get access to an email address without even the need for entering the password?
You are creating a google account. A Google account can be associated with any email id.
If you use a custom email id, you can use all the gsuite features like docs etc from that email id, but you cannot access your email via gmail.
To use gmail on a custom domain you have to pay ( change mx servers etc also )
This is done by using MX records.
Mail Exchange (MX) records are DNS records that are necessary for delivering email to your address.
In simple DNS terms, an MX record is used to tell the world which mail servers accept incoming mail for your domain and where emails sent to your domain should be routed to. If your MX records are not pointed to the correct location, you will not receive email.
MX records consist of two parts: the priority and the domain name. For example:
0 mail.EXAMPLE.com
The ‘0’ is the priority.
The lower the number means a higher priority.
The ‘mail.EXAMPLE.com’ is the mail server to which it connects. This is different - depending on what company is hosting your email.
Outgoing email servers connect to the MX servers in order of priority.
If you use more than one MX record and both have the same priority, it picks one at random. (This in effect load balances the connections.)
Your MX records are controlled at the company where your Nameservers are pointed.
Use MX records, provided by the G Suite Setup Wizard, to verify your domain (if you haven’t already verified it) and to set up Gmail as your professional email.
After you've switched to Google's MX records, you can receive your email in your Gmail inbox or through an email client like MS Outlook.
How it works
Keep setup instructions open and sign in to your domain host in another window or tab. Your host manages technical settings for your domain.
You’ll then update the MX record settings to direct your email to your G Suite account. It’s like registering a new address with the post office so that your mail gets delivered.
If you already use email with your domain (your email address ends with #yourdomain.com), you’ll start receiving messages in Gmail instead of with your old email provider.
Read more here https://support.google.com/a/answer/140034?hl=en

Receive (not forward) e-mail using Mailgun

I want to use Mailgun to send/receive messages programatically via API.
BUT I need to have also some mailboxes available using Thunderbird or other mail client.
For example I want to have user mailboxes at:
support#
sales#
admin#
And all other e-mails will be for API send/receive.
I can not forward my mail to GMail because I need to reply from the same address (sales#mydomain.com).
Please help.
There is a limitation to using the routing feature and that is that if you delegate a domain to be used by Mailgun you cannot use it with an email client.
That means that, for example, if you want to route emails to user#domain.com and then still use that email address with your favourite email client (be it Thunderbird, Outlook or Gmail) you can't do it. That is because of the way you've configured your MX records (email records in your DNS).
When you use Mailgun's routing functionality you delegate MX records to mailgun, which receives your emails, parses them and routes them according to your preferences.
So how do we solve your problem?
What you can do instead is set up your MX record on a subdomain.
Using subdomain.mydomain.com and pointing its MX records to mailgun will allow you to receive and parse emails through Mailgun.
This way you can have:
admin#subdomain.mydomain.com
sales#subdomain.mydomain.com
etc
will be handled by mailgun
while
admin#mydomain.com
sales#mydomain.com
will be handled normally with your email client.
Please do not hesitate in asking more details!
You need to configure your MX record settings for your subdomains in your DNS control panel.

Sending emails from my domain with SendGrid

I have a question that I guess is not just related to SendGrid.
Say, I own the mydomain.com domain, and I want to be able to send emails from, for example, team#mydomain.com.
Right now, when I go and manage my domain, I can see that I have added some MX record values added there. By doing this, I am able to send email using Gmail.
However, with Sendgrid I find this a little bit more confusing. I have read through the documentation, but I fail to see what should I do. I am using NameCheap, and all it comes to my mind is the following:
If I want to use Sendgrid to send emails from my application (Ruby on Rails), will I still be able to access my Gmail account and send emails using the same address (team#mydomain.com)? Is it compatible to have both (Gmail and Sendgrid) configuration in my domain?
Why don't I need to add any MX records for SendGrid?
First and foremost, the MX records for your domain are used only to specify the hostnames of the servers to handle INCOMING mail for your domain - i.e. the MX records have nothing to do with the servers that are used to send outgoing mail. You can use both Gmail's outgoing mail servers and Sendgrid's outgoing mail servers (and any other outgoing SMTP servers for that matter) to send outgoing mail for you domain. The only caveat to this is if you have an SPF record setup for your domain, but you didn't mention one so I won't elaborate.
MX records, as stated previously, are for specifying a server that handles INCOMING emails. You can use Sendgrid to send outgoing emails together with an email account service like Gmail. With Gmail, you would both send and receive emails. With Sendgrid, you would only send emails.
the MX records for the domain would be specified as those for Gmail/Google. The trick is in correctly configuring the SPF records, which is a TXT type record in the domain name. In the SPF record, you would include both Gmail/Google info as well as Sendgrid info on the same line.
So, say you only used Gmail for sending and receiving email, your SPF record would look something like this:
v=spf1 include:_spf.google.com ~all
However, if you add another server from another service, say Sendgrid, in order to also send verified emails for that domain, the SPF would be altered to something like this:
v=spf1 include:_spf.google.com include:u826348.wl.sendgrid.net -all
In both of these examples, only the GMail/Google MX records would be added to the DNS records.