devWhiz Posted March 1, 2011 Share Posted March 1, 2011 Can someone show me a simple mail script that I can run in cli, I can enter a $to = email@email.com and then have it send to my email? just in cli.. Thanks Quote Link to comment Share on other sites More sharing options...
devWhiz Posted March 1, 2011 Author Share Posted March 1, 2011 this below returns mail failed.. How do I get it to send even if the email does no exist? <?php //define the receiver of the email $to = 'example@yahoo.com'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\n\nThis is my first mail."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: youremail@gmail.com\r\nReply-To: youremail@gmail.com"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> Quote Link to comment Share on other sites More sharing options...
devWhiz Posted March 1, 2011 Author Share Posted March 1, 2011 Im trying to do this without an SMTP server Quote Link to comment Share on other sites More sharing options...
devWhiz Posted March 1, 2011 Author Share Posted March 1, 2011 actually how would I set it up using googles SMTP Quote Link to comment 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.