Sending email on behalf of user via SMTP? - email

I'm building an app to allow my users to send email. I want the email to originate from their domain. Currently, email is sent on behalf of my Mandrill account with their name/email used for the From header. It "works" but most of the mail is not delivering as best as I think it could.
The way I see it, one option is to use a service like Mandrill, Mailgun, Sendgrid, etc and have my users update there TXT records to verify their domains, thus allowing me to send on behalf of my users. Is that correct?
I'm wondering if another option would be to collect SMTP credentials, and then send the message via SMTP for my user, thereby preventing my user from having to log in and update their TXT records before using my app to send messages. I think it would be far easier to simply add SMTP credentials. Is this possible?

"The way I see it, one option is to use a service like Mandrill, Mailgun, Sendgrid, etc and have my users update there TXT records to verify their domains, thus allowing me to send on behalf of my users. Is that correct?"
Correct you'll want them to minimally have an SPF record that says the service you use is allowed to send email for the domain. I.e. TXT v=spf1 +a +mx inlcude:sendgrid.net ~all
"I'm wondering if another option would be to collect SMTP credentials, and then send the message via SMTP for my user, thereby preventing my user from having to log in and update their TXT records before using my app to send messages. I think it would be far easier to simply add SMTP credentials. Is this possible?"
Not really. They'll need to make sure their DNS records minimally have a valid SPF (TXT) record, otherwise the major email providers and players will either drop their messages or mark them as SPAM/junk.

Related

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/

Use Google Apps and Mandrill/Sendgrid to send emails

Right now I have dilemma with email part of my projects. I'm using Sendgrid to send and receive emails (via webhook). All email functionality is integrated in my web application and all the emails are stored in the database. I want to know is it possible to do next:
Use Google Apps to receive inbound emails for support#domain.com
Use Google Apps to send outbound emails from support#domain.com
Use SendGrid or Mandrill to send outbound transactional and news
emails from noreply#domain.com and news#domain.com
Current problem is in MX records. Both Google and SendGrid MX records are required to be set in my DNS, but as far as I understand only one of them will actually work.
What is the best solution to make it possible?
Thank you.
One possible solution:
Point your MX records to google for your top level domain, domain.com.
Create support#domain.com email
Next, create a subdomain (i.e: sub.domain.com) and point the mx records to sendgrid.
Then, set up news#domain.com to forward to news#sub.domain.com. This way those emails get sent to your application.
Nothing needs to changed for sending outgoing transactional emails with SendGrid. You can send emails from news#domain.com. I also recommend to NOT USE noreply#domain.com, this hurts your deliverability(https://sendgrid.com/blog/why-you-should-not-use-noreplydomain-com-in-your-emails/)
The easiest solution is probably to use a subdomain for either the inbound emails or the outbound emails, so that you can keep the MX records separate. Receive emails to domain.com, send from e.g. mail.domain.com

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.

Setup SPF Record to allow sending email from Google Apps and Bluehost

I need to be able to send emails from Google Apps (my gmail account) and from my website which is hosted on Bluehost. How do I create an SPF record that will allow me to send emails from those locations but will restrict sending emails from other locations?
Like this:
v=spf1 include:_spf.google.com a a:abc.example.org a:xyz.example.org -all
This says, include Google's SPF record (which will allow all their mail servers to send mail on behalf of your domain), and allow anything in this domain which has an A record, and specifically allow 2 other hosts by verifying their A records. Fail everything else.
For this to work, you will need to know exactly which mail servers outbound mail will come from via Bluehost. I don't know much about them, but that might be your own server, or their outbound servers. If the latter, you might also be able to use another 'include' clause to include their record so you don't have to keep up-to-date with any changes they make.
This site is a useful tool. Google offers others. http://tools.bevhost.com/spf/

Sending emails from vendor's multiple domains

We have custom cms that currently sits on a vendor's subdomain, such as cms.vendor.com. It sends email out as coming from user#vendor.com and it seems to be working fine (using Email Queuing + SwiftMailer)
Our vendor asked us to put in the functionality for his users to be able to select from a dropdown, 3-4 other emails address associated with them from other domains he owns. Basically we need to be able to send out emails from our server labeled as being sent from #hisdomains.com, multiple domains.
I am a web programmer and have no clue when it comes to relaying messages. How would I go about being able to send out emails from his other domains? Does he need to setup permissions on his mail servers, or do I need to get into his SMTP servers to send out?
What are some things I should look out for when it comes to SPAM and gmail trusting us?
EDIT:
Not sure if my original question was clear enough. Vendor owns three domains: mysite.com, myothersite.com, mythirdsite.com. He wants a user from our crm to be able to send emails he has on those domains. So my dedicated server will be trying to send an email out as user#mysite.com, user#myothersite.com, and user#mythirdsite.com in the FROM: header.
As long as your server is allowed to send on behalf of a domain your vendor owns, you should not have a problem; just change the From: header to something else when you send out the e-mail.
Stuff like SPF, Sender ID and DKIM have to be properly configured to allow your server to send on behalf of any domain.
See also: http://en.wikipedia.org/wiki/E-mail_authentication
Any domain where the mx record resolves to the same server will work. so user#any.domain will email the same user on the mx contingent server.
To answer your question - just make sure that the mx records in the DNS zone file for each domain name points to the same server as the domain you want to share emails on.
also dependent on server configuration (like shared or whatever) I'm assuming it's dedicated with a simple email server installed. I'm not sure on cPanel/shared servers. but possibly the same.