When calling the mail function it produces the error
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
I am using Wampserver 2 and I assume the error is because Wamp does not come with a mail server. I then added the following code (as per an answer here)
ini_set("SMTP","aspmx.l.google.com");
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: test@gmail.com" . "\r\n";
mail("email@domain.com","test subject","test body",$headers);
and it produced the following error
Failed to connect to mailserver at "aspmx.l.google.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()
In the php.ini file located in C:\wamp\bin\php\php5.4.3 it contains the following settings
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = you@yourdomain
How can I send e-mail while running the files locally?
Where I'm working it really isn't redibly available which information the companies ISP uses for mail (in fact the company is it's own ISP). Is there another way to test this without finding the right port, if one even exists?