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

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.

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!

Change FROM header of email without being marked as spam

So I'm not having much luck finding information on how to send email with custom From header without being potentially marked as spam (for email spoofing).
The reason we want to do this is we run a server for many client's websites, but we don't host their emails is most cases.
We wish to send enquiry emails from the websites using their preferred address (e.g. sales#mycompany.com) so that their customers can reply to the email.
At the moment we're using a Google Apps email address and changing the Reply-To header, but this is ignored by Outlook almost all the time (not sure why).
In most cases we have access to the DNS records, so is it as simple as adding our server's IP address to the domain's SPF record?
Or should we look at a third-party solution for this?
Thanks in advance!
Yes you need to add SPF records to the DNS TXT record.
So if you want to send an E-mail as user#foo.bar from IP address 192.168.3.4 you need to create (if you are not the admin of foo.bar) a DNS TXT record/s for foo.bar as such
v=spf1 +ip4:192.168.3.4 -all
This tells the remote server that the foo.bar domain sends legitimate email from 192.168.3.4 and that all other sources are only pretending to be foo.bar.
Note that the IP can be either ip4 or ip6.

Error sending emails from PHP with PHPMailer

I need your help! I have a code in PHP for sending emails (PHPMailer version 5.2.7). Send email from PHP, I use this method usually.
I explain me...
The mails sent go directly to SPAM folder to Hotmail, Gmail...
I have my own server with two domains (unique IP for two domains). In the domain1 the mails sent correctly (PHPMailer 5.2.7) and go directly to de inbox folder. In the domain2 the mails sent correctly but mails go directly to SPAM folder (PHPMailer 5.2.7)!!
Which is the difference between domain1 and domain2?? Have the same ip...
I can do mailings to domain2 not reach the spam folder?
P.D.: Shipping method in PHPMailer is SMTP with user and pass verified.
There could be multiple factors that results in mail getting routed to spam folder. I don't think, it is anything to do with PHPmailer. It is something to do with your IP reputation, complaints, activity, user engagement and some other factors.
One reason could be, that your mail server uses only one ip to send from.
Maybe the the reverse lookup from that ip resolves to your domain1.
Also related are dkim and spf records.

Where is verification to check sender email address set?

I have 2 different domains hosted by the same provider. On one of the domains, i can send an email using the PHP mail function with a from address that does not exist e.g. noreply#myrealdomainname.com.
On my other domain (which i know is hosted on a different server), the mail does not reach the recipient and an error email appears in the catchall mailbox of the domain saying that the sender address could not be verified. I can obviously fix the problem by using a valid from email address but i would like to understand where the setting is which forces the one domain to have the check done and the other one not.
Is it a setting somewhere on the server or a piece of software running on the server? I have asked my hosting company but have not had any success with an answer.
Many thanks
Bianca

cPanel's SMTP or google hosted SMTP?

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

Categories