cPanel's SMTP or google hosted SMTP? - php

I'm wondering what mail servers I should use for sending mail through my website, avoiding them sent as spam.
Hostgator SMTP
google hosted SMTP
I found that to avoid a mail sent as spam it should have the same host in "From:" and "Received". How to overcome this?
Thanks

you should really check (or create) your dns SPF record: it specifies which server is allowed to send email for your domain name. Hotmail and gmail users, among others, may find your emails in their junk folder if you set these incorrectly or not at all.
Also make sure you have a reverse dns record set to your domain name. your recipients Mail servers will check if your mail server's ip address is fixed or dynamic (if dynamic, it's most probably spam). See wikipedia
checking the domain names in the rDNS
to see if they are likely from dialup
users, dynamically assigned addresses,
or other inexpensive internet
services. Owners of such IP addresses
typically assign them generic rDNS
names such as
"1-2-3-4-dynamic-ip.example.com."
Since the vast majority, but by no
means all, of e-mail that originates
from these computers is spam, many
spam filters refuse e-mail with such
rDNS names

Related

PHP Mail SPF failure

We have a problem using PHP mail on a shared hosting server on 1and1.com
We use SPF entries in our TXT DNS settings which include the email servers we use also confirm that outgoing emails are sent from our domain email addresses.
The scenario is: We have a button feature that allows site users to send a personal email from their email address to a client email address.
The problem is: These emails either bounce or end up in SPAM because they do not pass the SPF test.
Although I realize that we can solve the problem with a dedicated server, I was hoping someone had a solution or a way that we could solve the problem and still remain on shared hosting.
Thanks!

Sending email from a web server if it's hosted on another server

I am in the process of having a web app built. And it will link into other people's websites.
It's purpose is to be a login to a portal which will manage their customers and data.
My app will at some point send an email to their customers acting upon the clients interest.
My concern is that we won't be hosting our clients emails.
So my question is can I get my web server web app to email the customers of my clients using their email domain name?
I think all I would need is the mail server and email account details.
I think I'll be using phpemailer unless anyone can recommend anything else? Is it even possible?
I'm just looking for answers or documentation ton help me setup configure if anyone knows of any.
Thanks in advance
As Barmar says, if your clients include your servers address in their spf records (and only use SPF for protection) then your mail server can send messages with a from address with the clients domain.
However, there another schemes, DKIM, which requires a private key issued by the client. To confuse things further, there is a scheme combining DKIM and SPF called DMARC.
Multiplexing the schemes and client keys via your own MTA is a formidably complex task. While #Barmar usually gives good advice, in this case I think a recommendation to simply ask the clients to include your domain in their SPF is not the best approach.
There are a lot of different choices:
a link back to the clients MTA (for clients whom operate their own MX) which would need to support SMTPS and SMTP authentication. Possibly even vpn support
the spf based model (for those not using DMARC or DKIM)
sending emails from your MTA but with a a masqueraded text part in the email address, e.g.
From: "a_user#yourclient.com" <a_user_yourclient#yourdomain.com>
...but with a Reply-to header pointing to the clients address, although this may impact your IPR
just use the clients email as the from address for those without any protection scheme
It would be straightforward to handle the initial routing of the email within your applications code, but you are going to need developers who really understand how email works in practice.
I would recommend you to use mailgun... Mailgun is simple to implement, you can send 10000 emails for free every month (see below) and you can send emails in behalf of clients domains. You need to add new domains to mailgun account and verify them like it's described in the documentation (see below).
Official SDK for php
https://github.com/mailgun/mailgun-php
Domain verification documentation https://documentation.mailgun.com/en/latest/quickstart-sending.html#verify-your-domain
Pricing plan if you need to send more than 10k per month..
https://www.mailgun.com/pricing
Here are some options:
If your client provides you with an account in their email environment, then you can send using those credentials. Assuming your client has a properly configured mail environment (SPF and/or DKIM and/or DMARC), then everything should be good.
You can send from your email server directly, but your client's SPF records should include your server's IP address(es) if you don't want the email to go to spam. (Though it's possible the email will not go to spam depending on a lot of voodoo related to spam filtering and IP reputation)
You could have your client setup a DKIM DNS entry with a public key that you generate. Then you could have your server sign the message using DKIM and send it on behalf of the client.

emails won't send to certain recipients in php

I have a registration activation email that needs to be sent out. It sends out fine to gmail, yahoo and the other well known email handlers. However, it won't send to .edu and some other less well known extensions. Is it something that is caused on my side or something on the other side blocking emails with certain characteristics. I am emailing a link after all.
This can have several reasons:
Your sending Mailserver is blacklisted.
Your PTR-Record is different from the A-Record of your Server.
The receiving Mailserver denies the Mail, because of the incoming Firewall rules or the Mailserver settings.
For number one you can take a look if your Server is blacklisted: http://mxtoolbox.com/blacklists.aspx
For number two you can check your PTR-Record: http://mxtoolbox.com/ReverseLookup.aspx
If the reverse lookup is different from your A-Record you can bypass this in your Mailserver settings, while you change the banner to the output of the reverse lookup.
I hope this helps :-)

Email sending not working in Mailgun to Outlook

I'm using mailgun API for sending emails to the user accounts. I keep checking the mailgun log for checking the send statuses. My problem is everything is working fine when sending emails to gmail and yahoo. It is not working for hotmail. I have checked the junk folder in hotmail. I couldn't find the email. Here is the mailgun log for the delivered status to hotmail email account.
02/24/14 04:44 AM Delivered: decodedtool#sandboxunique.mailgun.org → vinodkumar.u93#outlook.com 'Welcome! Outlook Test'
Please help me to resolve this. Thanks in advance.
Although it seems as if it is delivered, in fact it was blocked by hotmail.
You should check your Bounce tab in mailgun but you probably won't find anything there too.
Take the following steps to try to narrow the causes:
Check the headers of a delivered email to see what mailgun server it was sent from.
Get this IP and search it for blacklisting. Especially in http://www.spamcannibal.org/
Lookup the same IP at SendScore.
Now, assuming that you don't have a dedicated IP from Mailgun, you'll notice that your IP might not be blacklisted but several other IPs from the same range might be. This is enough for hotmail to block your emails without giving you a reason.
Ask Mailgun to move you to a different IP and hope that a bad internet marketeer won't be using it too.
Hope this helps
Theodore
While the above answer does have a few helpful hints, it is inaccurate in a few respects.
First, Hotmail does not block emails based on a SpamCannibal listing. Hotmail's own IP's are listed with this blacklist as well as the IP's of every other major ESP. Second, the reason that the IP's are listed with SpamCannibal is that they are a blacklisting service that extorts payment in return for being delisted. Of course, once delisted, nothing stops SpamCannibal from placing the IP - or an entire subnet - back on the listing. Third, no reputable ESP uses SpamCannibal in their filtering decisions. Fourth, the only known service that relies on SpamCannibal is the obscure Linux spam filter Linux Magic, and that's only because that service does a lookup of the blacklists on MX Toolbox.
All in all, being listed on SpamCannibal will not affect email delivery, regardless of whatever email service you use. If you're being blocked by Hotmail, it could be due to your domain's reputation, your IP's reputation, or your email content (usually the last option). To see Hotmail's email policies, visit http://mail.live.com/mail/policies.aspx as well as this interesting discussion here http://community.office365.com/en-us/f/148/t/174524.aspx

Email to be sent out from a dedicated server with different IP

We have three domains hosted on one dedicated server each with its own dedicated IP.
Domain A - Has the server primary IP address (default server IP)
Domain B - Has its own IP address
Domain C - has its own IP address
If an email goes out from Domain B then it uses the Domain A IP address in outgoing and this makes emails from Domain B using PHP go straight to spam box of Gmail etc.
Is there any way to change the source IP depending on where the email originates from in PHP? What should we change to fix this?
This is nothing to do with PHP.
No you can't spoof addresses in the way you suggest - but the reason that emails are being classified as spam is because you've only got Host A published in your SPF. Just add the others to the permitted senders list:
"v=spf1 a:hostA.example.com a:hostB.example.com a:hostC.example.com"
C.
You're not giving any details about your server setup so this can't really be answered. PHP can, however, use a SMTP server of your liking. The easiest way to set this up is a tool like PHPMailer.
If you can't change the IP you're sending from, you need to change domain B's MX record making Domain A (or its IP) the mail server for that domain. I'm pretty sure spam filters like Google mail look for the MX record only. Of course, you would have to have both E-Mail sending and receiving facilities on Domain A for this to work.
PHP is usually set up to drop mail onto the localhost MTA, which will always send it on from its own bound IP address. So, no.
To reduce the chances of being marked as spam because your mail comes from an address that doesn't tie up with the DNS records (MX or fallback A) for a domain, add an SPF record to the DNS for all the domains saying that mail from the sending IP address is fine.

Categories