I've got an already configured mail server with 12 IP addresses.
Do I need any special configuration of SwiftMailer to use it properly ?
Or its only my server job to use these IP addresses ?
You should be connecting to your mail server with SwiftMailer using it's hostname rather than one of the IP addresses and you will be fine.
Related
I am sending mail in PHP, but I use a remote mail server.
I have three questions:
1) In my PHP mail code, should I use the server settings for the local mail server or the remote mail server and is there a difference?
2) If I use the remote mail server, won't the mailserver domain IP address not match the real domain's IP Address (potentially going to Spam folders)?
The problem I am having might be specific to my host, mail server, version, or mail plugin.
I am trying to use a plugin called Swiftmailer to send mail through my local mail server, which works on port 25 with no SSL. When I switch the port to 465 (per my host's recommendation) and change it to SSL, I get a refused connection. (I believe this is because I don't have SSL added to this server yet)
3) Does SSL really matter? Should I just use port 25 without SSL and save myself the trouble? (I care about security, not server requirements)
I'll try to explain the problem we have at my company the best I can :
So I have several forms across different servers. All are sent up to send emails with the mail() function in PHP to the email address email#ourcompany.fr
Now I've noticed a weird behavior : when the forms are hosted on our server (I'm talking about our apache server, the mails are handled by an exchange server) they arrive fine at the address up there.
But when the forms are hosted anywhere else on the internet, the emails arrive at the address email#ourcompany.es
What could the problem be ? SMTP configuration ? A set of rules at the exchange server ?
I am pretty much a newbie when it comes to emails and how they're handled when they're sent...
Thank you for your help.
EDIT: As per MarcB recommendation I tried the following in the shell :
XXXX:~$ nslookup -type=mx securitasdirect.es
Server: 10.40.144.166
Address: 10.40.144.166#53
securitasdirect.es mail exchanger = 10 smtp.securitasdirect.es.
XXXX:~$ host -t mx securitasdirect.fr
securitasdirect.fr has no MX record
XXXX:~$ host -t mx securitasdirect.es
securitasdirect.es mail is handled by 10 smtp.securitasdirect.es.
Alright so based on your update... and running dig from my local machine to confirm, your securitasdirect.fr domain has no MX records setup on the publicly accessible DNS servers.
Internally in your network, it's possible (likely even) you use different DNS servers which have MX records and hence internally you can deliver email to #fr while externally it's not working.
Update not sure if you're changing things as I write this answer, but it seems like I'm now getting a valid MX return for securitasdirect.fr.
Beyond that, securitasdirect.fr fails the rDNS test (see: http://www.mxtoolbox.com) while securitasdirect.es passes. It's possible this is also interfering with mail delivery.
A customer's website address is customerswebpage.com (not the real one, of course). The server itself has it's host name configured to server.customerswebpage.com, which has no A or MX type DNS records. This causes many web servers to refuse mail from this server.
Is there an easy and/or neat way to change the HELO address the server identifies itself as? The site is built on the Symfony framework version 1.0 and we're using the sfMail plugin to send the mail. The only solution I could think of so far is taking a copy of the whole plugin and modifying it to suit our needs, as the hostname is used only internally.
Maybe even more importantly, do you think we could say this is a DNS misconfiguration?
I think HELO needs to be changed in server's MTA and not in php.
http://www.sendmail.org/m4/whoami.html
You should probably just add the missing A and MX DNS records for server.customerswebpage.com and not change HELO.
Mail servers can be really picky, and it is by no means granted that adding a proper A and PTR record for the server will resolve all issues. It is usually most hassle-free to use an external smarthost (for example via your ISP or a dedicated service) for outgoing mail, and let them worry about deliveries.
The sfMail package is based on PHPMailer, and that package stores the HELO host name in $helo. Perhaps you can overload the sfMail phpMailer class and set that variable?
A way for avoiding this problem is to use sfMail with SMTP. So you can send your E-Mail with your real Mailserver so the SPF and MX Records are right.
I want to know if there is a option in php or .net to say from which ip address we can send out email.
We have couple ip addresses on one of our servers and we don't want to send the emails from the default ip, instead we want to send them from the other ip.
Thanks in advance.
PHP can't control the outgoing IP, since it's not acting as a mail server. the mail() function simply connects to whatever SMTP server is specified in php.ini and hands the mail over for the SMTP server to handle.
You can certainly tell the SMTP server which IPs it should bind to, here's how for Postfix. If your website's on a.b.c.d, you want emails to appear from e.f.g.h, then tell Postfix (or whatever server you're using) bind to e.f.g.h and 127.0.0.1.
And of course, you could always run the SMTP software on a completely seperate server as well.
It is controlled by the operating system, not php.
Do you have a SMTP server you can use? That way you will be sure it isn't being sent from a webserver IP address.
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.