Hey everyone, I have been trying to send a test email before I do any further development and can't see to figure out why I am getting this 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()

This is the code I I decided to use to test

$to = "wlopez@corp.ptd.net";
    $subject = "Hello!";
    $txt = "Hello world";
    $headers = "From: webmaster@example.com" . "\r\n" .
    "CC: somebodyelse@example.com";

    mail($to, $subject, $txt, $headers);

I changed the php.ini file to the actual SMTP server of the company but still can't seem to figure out what is going wrong on my part. Any help would be great!

Did you test if your email server works like this? https://www.google.com/#q=how+to+test+smtp+email+with+telnet for example is our first test.

Also, line 4 is likely wrong. "As described in RFC 2606 and RFC 6761, a number of domains such as example.com and example.org are maintained for documentation purposes." and a good email server should drop such from header possibly as spam.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.