ultrus Posted April 29, 2010 Share Posted April 29, 2010 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, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.