Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
799 views
in Technique[技术] by (71.8m points)

php - Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry

The following script sends email using mail function . But i am unable to send an email.Upon clicking submit this gets displayed :

Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in E:xampphtdocsfeedback.php on line 19
mail sent successfully

SCRIPT

<?php 
if( isset( $_REQUEST['email'] ) ) {
    $email = $_REQUEST['email'];
    $subject = $_REQUEST['subject'];
    $message = $_REQUEST['message'];
    mail("me@gmail.com" , $subject , $message , "From:".$email );
    echo "mail sent successfully";
}  else {
     echo "<form method = 'post' action = 'feedback.php'>
     Email of sender : <input name = 'email' type = 'text' /> <br/>
     Subject : <input name = 'subject' type = 'text'/> <br/>
     Enter your feedback here : <textarea name = 'message' rows = 15 cols = 40 > </textarea> <br/>
     <input type = 'submit'/>
     </form>";
   }
?>

I am using Apache as php server

Also tell why we have to write $subject , $message i.e with the $ sign in the mail argument , since we have declared $email , $message etc. , just above. Why can't we just write message , email , .. without the dollar sign?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Resolvendo: In Xampp menu,
Go to mercury admin-->Configuration menu-->MercuryS SMTP Server-->Connection control. In that window, remove the check on the checkbox. See below:

enter image description here

Then in php.ini file:

[mail function] SMTP=127.0.0.1 <------------------change localhost to ip local

smtp_port=25


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...