I'm using mail
to send e-mails from PHP. It's working fine, but now I need to use a more secure mail server.
I need to connect with the mail server using the following configuration:
smtp: "mail.newserver.com"
port: "25"
timeout: 60
auth: yes
user: name
pass: word
How should I change my code below so it works with above configuration?
$to = $SendTo;
$headers = "From: <info@---->" . "\r\n" . "X-Mailer: php";
$subject = "Website Contact : " . $uxGlobalLocation;
$body = $Bodycopy;
if (mail($to, $subject, $body, $headers)) {
header ('Location: /index.php?option');
exit();
} else {
echo("<p>Message delivery failed...</p>");
}
Actually mail function doesn't provide authentication functionality. Your have to use Mail class from Mail Pear package. See here for an example: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With