sending e-mail form to a non-local e-mail address
Posted: Wed Sep 30, 2009 10:59 am
Hi
I am using the mail() function in PHP. I'm trying to send a form by email to a different email address which is out side of my domain but i'm getting this error (see below). can any one help me with this?
also the php code i've used is under the error.
Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.
I am using the mail() function in PHP. I'm trying to send a form by email to a different email address which is out side of my domain but i'm getting this error (see below). can any one help me with this?
also the php code i've used is under the error.
Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.
Code: Select all
<?php
$from = $_REQUEST['email'];
$firstName = $_REQUEST['firstName'];
$surname = $_REQUEST['surname'];
$question = $_REQUEST['question'];
$chairs = $_REQUEST['chairs'];
$safety = $_REQUEST['safety'];
$furniture = $_REQUEST['furniture'];
$paper = $_REQUEST['paper'];
$safes = $_REQUEST['safes'];
$shredders = $_REQUEST['shredders'];
$printerLink = $_REQUEST['printerLink'];
$binding = $_REQUEST['binding'];
$machines = $_REQUEST['machines'];
$stationary = $_REQUEST['stationary'];
ini_set ("SMTP","mail.mydomain.com");
ini_set('smtp_port', 25);
ini_set ("Username","bryan@mydomain.com");
ini_set ("Password","Password");
ini_set ("sendmail_from","bryan@mydomain.com");
$to = "someone@some-else-domain.com";
$subject = "Newsletter";
$message = "Newsletter\n\nName: $firstName $surname\nE-mail: $from\nBusiness or Personal?: $question\n\nProducts you are interested in:\n\nchairs: $chairs\nsafety: $safety\nfurniture: $furniture\npaper: $paper\nsafes: $safes\nshredders: $shredders\nprinterLink: $printerLink\nbinding: $binding\nmachines: $machines\nstationary: $stationary";
$headers = "From: $name <$from>";
mail($to,$subject,$message,$headers);
header( "Location: newsletter-sent.php" );
?>