maryum Posted November 20, 2008 Share Posted November 20, 2008 hi can anyone tell me how i can send mail to a real e-mail address using php. thnx Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/ Share on other sites More sharing options...
trq Posted November 20, 2008 Share Posted November 20, 2008 mail(). Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694175 Share on other sites More sharing options...
maryum Posted November 20, 2008 Author Share Posted November 20, 2008 i have used this function but it sends mails to local users only, users created on localhost, but i want to send mail on a real address such as at abc@yahoo.com Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694177 Share on other sites More sharing options...
gmcalp Posted November 20, 2008 Share Posted November 20, 2008 an example: mail("yourname@yourdomain.com","Subject Line Text Here",$message,"From: ".$email.",$headers,"); Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694179 Share on other sites More sharing options...
maryum Posted November 20, 2008 Author Share Posted November 20, 2008 i have used the following code <? ini_set("SMTP", "127.0.0.1"); ini_set("smtp_port", 25); $to = $_POST['to'];//xxx@yahoo.com $from = "admin@localhost"; $subj = $_POST['subj']; $msg = $_POST['msg']; $header = "MIME version: 1.0\r\n"; $header .= "Conttent-type:text/html;charset=ISO-8859-1\r\n"; $header .= "From:$from \r\n"; $header .= "Cc: $cc \r\n"; $header .= "Bcc: $bcc \r\n"; $header .= "Reply-to: <$from>\r\n"; $header .= "X-Mailer: PHP/".phpversion(); $mail_sent = mail($to, $subj, $msg, $header); echo $mail_sent ? "Mail sent" : "Mail failed"; exit;?> but following error occours Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in D:\xampp\htdocs\mailing\srvrsendmail.php on line 18 Mail failed Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694181 Share on other sites More sharing options...
trq Posted November 20, 2008 Share Posted November 20, 2008 Your mail server is not configured to send exteranl mail. Id'e suggest either using a remote mail server (provided by your isp) or reconfiguring your local mail server. Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694184 Share on other sites More sharing options...
maryum Posted November 20, 2008 Author Share Posted November 20, 2008 i m using mercury mail server can u please tell me how to configure it to send external mails Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-694186 Share on other sites More sharing options...
maryum Posted November 22, 2008 Author Share Posted November 22, 2008 if anyone wants the solution can chk the followiing url http://www.apachefriends.org/f/viewtopic.php?t=32089 Quote Link to comment https://forums.phpfreaks.com/topic/133466-solved-send-mail-to-a-real-address/#findComment-696116 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.