Hepp Posted March 3, 2007 Share Posted March 3, 2007 I have two different servers, a web and a mail server. The mail server uses localhost and the port of 25 for SMTP in php.ini, and the "sendmail_from" is set in php.ini - I'm 100% sure. I tried making a simple mail script work... <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('[email protected]', 'My Subject', $message); ?> I have the php.ini "sendmail_from" setting to a different email than in that code. I need the code to have different emails for such things as a forgot password script when parsing info over $_POST, like the email. I need it to send the info to their email, not the one in php.ini. Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in *FilePath* on line *SomeNumber* And it's given me a headache to the max. And now I'm angry at this thing. GAH! ??? Any suggestions? Thanks for the help if so Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/ Share on other sites More sharing options...
mmarif4u Posted March 3, 2007 Share Posted March 3, 2007 Hi, 1st of all u have to call or pass 4 arguments in ur mail function. U forgot to define the From: argument or headers. Do it like this: $headers = 'From: My program <[email protected]>' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); Then: mail('[email protected]', 'My Subject', $message,$headers); Try this i think this will work. Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198315 Share on other sites More sharing options...
Hepp Posted March 3, 2007 Author Share Posted March 3, 2007 Progress... thank you for your reply mmarif4u. I set the header email to the one in php.ini... Now I only get this error message: Warning: mail() [function.mail]: SMTP server response: 550 Account is not local, relaying disallowed. Any more ideas? Anyone? Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198318 Share on other sites More sharing options...
mmarif4u Posted March 3, 2007 Share Posted March 3, 2007 try to use ur domain name account not others,bocz some it create problems like when the mail is sent it goes to spam folder. Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198321 Share on other sites More sharing options...
Hepp Posted March 3, 2007 Author Share Posted March 3, 2007 Thank you for your help again. I don't quite understand what your saying, but I need to use the email the user supplies in the input field in order for them to receive the mail and not the one in php.ini. Like: They enter their email, click "Retrieve Password", the PHP code matches their email with the one in the database and grabs their password, puts the correct password in the message, then sends the email to that users email, along with their password. I need this. Anymore suggestions? Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198322 Share on other sites More sharing options...
mmarif4u Posted March 3, 2007 Share Posted March 3, 2007 <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('[email protected]', 'My Subject', $message); ?> Try this code: <?php //The headers $headers = 'From: MY Program <[email protected]>' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // The message $message = "Good Day! Your personal password with username are as follows: email : " . $cleaned_for_sql['email'] . " password: " . $password . " Your New password for My program. Webmaster "; // Send mail($cleaned_for_sql['email'], 'My Subject', $message,$headers); ?> But remember that have to run a sql query for matching the email and then retrieving the password or username(what to u want to send to the user). Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198328 Share on other sites More sharing options...
Hepp Posted March 3, 2007 Author Share Posted March 3, 2007 Thank you for your reply. Your solution unfortunately did not work, and gave me the same error :-\ Thank you for the help though. Any other suggestions? Anyone? ??? Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-198507 Share on other sites More sharing options...
Hepp Posted March 4, 2007 Author Share Posted March 4, 2007 Anyone at all? I'm totally lost here. ??? Link to comment https://forums.phpfreaks.com/topic/40952-warning-mail-functionmail-sendmail_from-not-set-in-phpini-but-it-is/#findComment-199098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.