| Author: Priya 04 Sep 2008 | Member Level: Silver | Rating: Points: 1 |
How are you sending your mail? Can you post the existing code here?
Compare your code with this tutorial, if you have any bugs in the code, corect it. Let us see what happens now. http://www.sitepoint.com/article/advanced-email-php/
If you need further help, let me know.
|
| Author: Ramola 04 Sep 2008 | Member Level: Silver | Rating: Points: -20 |
mailform.php
<html> <body><?php ini_set('sendmail_from', 'e_ramola@yahoo.co.in'); if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("b.breety@yahoo.co.in","Subject:$subject",$message,"From:$email"); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?></body> </html>
The output willl be,
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for b.breety@yahoo.co.in in C:\xampp\htdocs\myphp\mailform.php on line 11 Thank you for using our mail form
|
| Author: Priya 04 Sep 2008 | Member Level: Silver | Rating: Points: 1 |
Try this: In the From Email place susbstitute a valid email and check the results first. So we can traceout which is causing the problem.
<html> <body><?php ini_set('sendmail_from', 'e_ramola@yahoo.co.in'); if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $to="b.breety@yahoo.co.in"; $email = "valid email"; //$_REQUEST['email'] ; // <------------------ Substitute here---------- $subject = "Subject:".$_REQUEST['subject'] ; $message = $_REQUEST['message'] ; $headers= "From: $email"; mail($to,$subject,$message,$headers); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?></body> </html>
|
| Author: Ramola 04 Sep 2008 | Member Level: Silver | Rating: Points: 1 |
hi priya, Both the mail ids I have used are valid mail ids..
|
| Author: Priya 04 Sep 2008 | Member Level: Silver | Rating: Points: 2 |
Ok. So did you try with another To Email address? Also what is the SMTP server setting in php.ini file?
If you are comfortable use phpmailer, it will handle all the SMTP related issues for you. http://phpmailer.codeworxtech.com/index.html http://phpmailer.codeworxtech.com/tutorial.html
|