Webmastersite.net
Register Log In

email problem with -f parameter

Comments on email problem with -f parameter

sertan6
Experienced

Usergroup: Customer
Joined: Feb 22, 2004

Total Topics: 47
Total Comments: 88
sertan6
Posted Dec 02, 2006 - 9:02 AM:

recently i found out that i could not send any emails, i contacted my host and he gave me this code for proper mail() usage:

$email_to = "MY_TO_EMAIL@EMAIL.COM";
$email_from = "MY_FROM_EMAIL@EMAIL.COM";
$subject = "test subject";
$body = "TESTING ";
$headers = "From: " .$email_from ."\r\n";
mail( $email_to, $subject, $body, $headers, "-f" . $email_from )

the existing mail() code in commonfuncs.php is:
mail( $email_to, $subject, $body, $headers, "-f")

i also found this code in http://php.net/function.mail:
-------------------------------------------------------
Example 3. Sending mail with an additional command line parameter.

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.
<?php
mail('nobody@example.com', 'the subject', 'the message', null,
'-fwebmaster@example.com');
?>
---------------------------------

i am not in a hurry though since i managed to fix it (at least the non-queue version)
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 03, 2006 - 1:34 AM:

I'm aware that some hosts need -f, which is why there's an option to use it on the Admin -> E-mails -> E-mail Preferences page. You haven't made it clear, so I don't know if you're saying you're using it or not. Are you unaware of the option, or are you saying it doesn't work as-is?
sertan6
Experienced

Usergroup: Customer
Joined: Feb 22, 2004

Total Topics: 47
Total Comments: 88
sertan6
Posted Dec 03, 2006 - 2:38 AM:

I have set the option but it is not working, no emails are sent.It is because of the way the parameter is set in the mail() function.

Once i changed my mail() function in commonfuncs.php, it started to send emails:

mail($thisto, $thissubject, $thismessage, "From: webmaster@my-domain.com\r\n", "-fwebmaster@my-domain.com")

mail ($to, $subject, $message, "From: webmaster@my-domain.com\r\n", "-fwebmaster@my-domain.com");
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Dec 03, 2006 - 9:38 PM:

Okay, I've tacked the email on after the -f now.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.