Jump to content

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini! But it is!


Hepp

Recommended Posts

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  ;D

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.

 

 

 

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?

Thank you for your help again.  ;D

 

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?

<?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).

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.