getyourkarthick Posted October 28, 2010 Share Posted October 28, 2010 I am testing my PHP script with post function to send emails,but the mail is not arriving in my inbox..?What may be the problem..? Quote Link to comment Share on other sites More sharing options...
gizmola Posted October 28, 2010 Share Posted October 28, 2010 MTA configuration on the server could be broken, or you could have an error in your code, or it's also quite likely that your email is getting delivered, but it's being spam filtered. Quote Link to comment Share on other sites More sharing options...
getyourkarthick Posted October 28, 2010 Author Share Posted October 28, 2010 MTA is working fine,if the mail is spammed it should be appeared in my spam folder but i dont get anything there..? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2010 Share Posted October 28, 2010 I'm going to vote for this choice as being the likely problem - ..., or you could have an error in your code, ... You haven't shown any code, so it is not possible to tell if what you are attempting is even valid. Based on your other thread about SMTP Authentication, does your sending mail server require it? If it does, there's no way you will be able to send an email through your mail server until you use a php script that supports SMTP Authentication. Edit: And frankly, you have at least two-three current threads about sending email. If you stick to a single thread for any particular problem, you will find that you will get a solution faster. Quote Link to comment Share on other sites More sharing options...
andrew_biggart Posted October 28, 2010 Share Posted October 28, 2010 Have you got headers? Quote Link to comment Share on other sites More sharing options...
getyourkarthick Posted October 28, 2010 Author Share Posted October 28, 2010 <?php session_start(); if ($_POST['Submit'] == 'Send') { $to = $_POST['toemail']; $subject = $_POST['subject']; $message = $_POST['message']; $fromemail = $_POST['fromemail']; $fromname = $_POST['fromname']; $lt= '<'; $gt= '>'; $sp= ' '; $from= 'From:'; $headers = $from.$fromname.$sp.$lt.$fromemail.$gt; mail($to,$subject,$message,$headers); header("Location: sendmail.php?msg= Mail Sent!"); exit(); } ?> <html> <head> <title>Email </title> </head> <body bgcolor="#ffffcc"> <h2 align="center"> Email </h2> <h3 align="center"> Please do not misuse this script. </h3><br> <p style="margin-left:15px"> <form action="sendmail.php" method="POST"> <b>From Name:</b><br> <input type="text" name="fromname" size="50"><br> <br><b>From Email:</b><br> <input type="text" name="fromemail" size="50"><br> <br><b>To Email:</b><br> <input type="text" name="toemail" size="50"><br> <br><b>Subject:</b><br> <input type="text" name="subject" size="74"><br> <br><b>Your Message:</b><br> <textarea name="message" rows="5" cols="50"> </textarea><br> <input type="submit" name="Submit" value="Send"> <input type="reset" value="Reset"> </form> </p> <?php if (isset($_GET['msg'])) { echo "<font color=\"red\"><h3 align=\"center\"> $_GET[msg] </h3></font>"; } ?> </body> </html> This is the code.. Quote Link to comment Share on other sites More sharing options...
andrew_biggart Posted October 28, 2010 Share Posted October 28, 2010 What kind of email address are you trying to send it to? Is it hosted on the same server? or is it hotmail gmail etc? If its not try adding something like this. $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2010 Share Posted October 28, 2010 Aside from the fact that you are allowing all the mail() parameters (to, subject, message, From: header) to come from the posted form data (spam bot scripts will love your script and get your mail server banned by all the major ISP's fairly quickly) you are setting the From: address to be the arbitraryly entered email address from the form (which is probably why you are likely triggering your mail server's SMTP Authentication requirement.) You must set the From: address to be an email address hosted at the sending mail server. You would set the Reply-to: address to be the address the visitor entered. Quote Link to comment Share on other sites More sharing options...
getyourkarthick Posted October 28, 2010 Author Share Posted October 28, 2010 What kind of email address are you trying to send it to? Is it hosted on the same server? or is it hotmail gmail etc? If its not try adding something like this. $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; I have configured my smtp server with gmail..What the above code will do..? Quote Link to comment Share on other sites More sharing options...
getyourkarthick Posted October 28, 2010 Author Share Posted October 28, 2010 I am trying to send it to gmail. 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.