mag0103 Posted June 12, 2008 Share Posted June 12, 2008 Hello everyone: I am trying to send a very simple email. I've tried everything in the header, still the mail() function doesn't email to my yahoo as well as my work email. Please find the code below and tell me what i am doing wrong here: $userid = $_SESSION['username']; $email_from = "[email protected]"; $to = $_POST['email']; $subject = $_POST['subject']; $note = $_POST['note']; if($to && $subject && $note) { $body = $userid ." has invited you to a meeting for ". $subject ."\n\n". "NOTE: " . $note; $headers = "From: " . $email_from . "\r\n"; $headers .= "To: " . $to . "\r\n"; $headers .= "Reply-To: ". $email_from . "\r\n"; $headers .= "X-Mailer: PHP / " . phpversion(); if(mail($to, $subject, $body, $headers)) { echo "mail sent"; echo "<script type='text/JavaScript'> setTimeout('window.close()',500); </script>"; } else { print "mail not sent, please try later."; } } // end check if primary fields are filled else { ?> <style TYPE="text/css"> form { font-family:arial; font-size:12px; font-weight:bold; } label { display:block;float:left;width:100px;clear:left; } .clear { clear:both; } </style> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form"> <label for="from">From:</label> <b><?php echo $userid; ?></b> <div class="clear"></div> <label for="email">*To:</label> <input type="textbox" name="email" value=""> <div class="clear"></div> <label for="subject">*Subject:</label> <input type="textbox" name="subject" value=""> <div class="clear"></div> <label for="note">*Note: </label> <textarea name="note"></textarea> <div class="clear"></div> <label> </label> <input type="submit" name="btn_sendemail" value="Send!" class="btn" /> <div class="clear"></div> <label><b><i>* required fields</i></b></label> </form> I am so desperate. Please help. Thank you much. Link to comment https://forums.phpfreaks.com/topic/109935-how-to-get-mail-email-to-yahoo-account/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.