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 protected] and then have it send to my email? just in cli.. Thanks Link to comment https://forums.phpfreaks.com/topic/229224-simple-email-script/ 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 = '[email protected]'; //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: [email protected]\r\nReply-To: [email protected]"; //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"; ?> Link to comment https://forums.phpfreaks.com/topic/229224-simple-email-script/#findComment-1181107 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 Link to comment https://forums.phpfreaks.com/topic/229224-simple-email-script/#findComment-1181109 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 Link to comment https://forums.phpfreaks.com/topic/229224-simple-email-script/#findComment-1181114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.