C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




runtime configuration for mail() in PHP


Posted Date: 02 Sep 2008      Total Responses: 5

Posted By: Ramola       Member Level: Silver     Points: 1


Hi all,

I used mail() function in my application for send a mail from PHP script.I know I have to set a runtime config for this.I got a error msg below:

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

plz let me know the config I should set in php.ini.dll

Thanks and regards




Responses

Author: Priya    04 Sep 2008Member Level: SilverRating:     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 2008Member Level: SilverRating:     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 2008Member Level: SilverRating:     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 2008Member Level: SilverRating:     Points: 1
hi priya,
Both the mail ids I have used are valid mail ids..


Author: Priya    04 Sep 2008Member Level: SilverRating:     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



Post Reply
You must Sign In to post a response.
Next : popup windows using winforms
Previous : how to replace an existing file
Return to Discussion Forum
Post New Message
Category: Windows

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

conference call definitions

Contact Us    Privacy Policy    Terms Of Use