Jump to content

Recommended Posts

Howdy,

At work with our hosting company, we've had an issue where mail() can't send emails to our own email addresses (just everyone else in the world). The hosting company offered the solution, saying that I can add an -f parameter in an email header which makes it work like this:

 

<?php
mail('someEmail@mycompany.com', 'Test Subject', 'test message', $headersHere, '-fmyEmail@mycompany.com');
?>

 

instead of:

 

<?php
mail('someEmail@mycompany.com', 'Test Subject', 'test message', $headersHere);
?>

 

That's a great start, but I can't afford to change all my scripts to work like that. Is there a way this can be configured on the server side to work like other normal websites?

 

From the php site on this page, here's some initial related info:

 

The additional_parameters parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

 

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

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 appreciate the tips muchly in advance!

 

Best regards,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.