Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Support > php issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-26-2007, 12:09 AM
Member
 
Join Date: Mar 2007
Location: Bristol, UK
Posts: 32
Post Email "sender" header

Hi

I'm sending mail using a simple form and using the php mail() command.

Whenever I send any email by this method the "sender" header is added/overwritten to "nobody@mirage.webhosting.uk.com".

I have tried sending no headers. I have tried specifying the "sender" header. Whatever I do the "sender" is added or overwritten.

I've looked in various places for information about this and it seems that I need to somehow set up a "trusted user".

Has anyone had or know about this problem? Does anyone know how to stop the "sender" header being added/modified? Does anyone know how to add a "trusted user".

Many thanks in advance.

Dave
Reply With Quote
  #2 (permalink)  
Old 03-26-2007, 10:44 AM
Administrator
 
Join Date: Mar 2006
Posts: 1,702
Default

Please go through following code :-

<code>
$to = 'sender@emailaddress.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: admin@yourdomain.com' . "\r\n" .
'Reply-To: admin@yourdomain.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>

</code> This is what has been given to me by our Senior System Administrator. He has verified proper working of this php code.
__________________
Web Hosting UK - ASP MSSQL Hosting - cPanel Linux Hosting
AIM : webredback || msn : andrew @ webhosting.uk.com
Toll Free : 0808 262 0855
Reply With Quote
  #3 (permalink)  
Old 03-26-2007, 02:01 PM
Member
 
Join Date: Mar 2007
Location: Bristol, UK
Posts: 32
Default

Hi

Thank you for the quick response. Unfortunetly I am still getting the same problem.

This is the code I have tried with as you suggested:

<code>
$to = 'walkerasindave@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: admin@theravedomain.co.uk' . "\r\n" .
'Reply-To: admin@theravedomain.co.uk' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
</code>

These are the basic email headers I'm receiving when I check walkerasindave@gmail.com:

<code>From: admin@theravedomain.co.uk
Sender: nobody@mirage.webhosting.uk.com
Reply-To: admin@theravedomain.co.uk
To: walkerasindave@gmail.com</code>

Its still coming up with the generic "sender" header.

If you need a full list of all the headers received it can be found in the attached file.

I am only really concerned about this header because it is visible in a number of email clients. If there is no way to remove I will just have to live with it

Many thanks

Dave
Attached Files
File Type: txt headers.txt (2.5 KB, 2 views)

Last edited by walkerasindave; 03-26-2007 at 02:04 PM. Reason: Added code tags for easy reading.
Reply With Quote
  #4 (permalink)  
Old 03-26-2007, 07:44 PM
kev woodman's Avatar
Premium Member
 
Join Date: Jul 2006
Location: Newport, Wales, UK.
Posts: 1,494
Default

Gmail has some issues with the ordering of headers so you could try this :

Code:
$headers = "MIME-Version: 1.0\r\n";
$headers .= “Content-type: text/plain; charset=iso-8859-2\r\nContent-Transfer-Encoding: 8bit\r\nX-Priority: 1\r\nX-MSMail-Priority: High\r\n”;
$headers .= “From: $from\r\n” . “Reply-To: $from\r\n” . “X-Mailer: PHP/” . phpversion() . “\r\nX-originating-IP: ” . remoteaddr () . “\r\n”;
mail ($to, $subject, $message, $headers);
__________________
homo sum: humani nil a me alienum puto ... ( just Google it )
Reply With Quote
  #5 (permalink)  
Old 03-27-2007, 01:45 AM
Member
 
Join Date: Mar 2007
Location: Bristol, UK
Posts: 32
Default

Hi

Thank you again for a quick response.

With the new suggestion additions I'm still getting the "Sender" header appended.

I've looked else where about it and it says something about adding a "trusted user". Does anyone know anything about this?

Thanks again

Dave
Reply With Quote
  #6 (permalink)  
Old 03-27-2007, 04:27 PM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Hi, Am not sure about trusted user but I think this is set in php.ini??

Forgive me if i am wrong but using php simple mail functions will always return 'nobody@' won't it? All emails using PHP are sent via nobody@, this is normal behaviour as Apache runs as "nobody" on linux. I am sure! (Admin will know better.)

One way around the problem you have is to use phpmailer at : <b>phpmailer.sourceforge.net</b>. I use this and it is a fantastic opensource mailing class.
Reply With Quote
  #7 (permalink)  
Old 03-28-2007, 09:45 PM
kev woodman's Avatar
Premium Member
 
Join Date: Jul 2006
Location: Newport, Wales, UK.
Posts: 1,494
Default

FWIW I'd say you're right Jon - Apache does run as 'nobody' so it is, effectively, the sender.

I've used phpmailer in a few projects and it always does the job - I have heard that " <b> swiftmailer.org/ </b> is very good as well though (some would say better - more OO apparently).
__________________
homo sum: humani nil a me alienum puto ... ( just Google it )
Reply With Quote
  #8 (permalink)  
Old 03-28-2007, 10:04 PM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Hi Kev, I haven't tried swiiftmailer, will take a ganders next time I need to use a mailer, thx.

Admin, how come the link to phpmailer disappeared? replaced with none link "phpmailer.sourceforge.net" strange!
Reply With Quote
  #9 (permalink)  
Old 03-29-2007, 08:45 AM
Moderator
 
Join Date: Sep 2006
Posts: 629
Send a message via MSN to harry
Default

Quote:
Originally Posted by jon123 View Post
Admin, how come the link to phpmailer disappeared? replaced with none link "phpmailer.sourceforge.net" strange!
Jon,
your anchor text link has been just replaced by simple url of the site; url specified by you has not been edited;
it's all for maintenance purpose.
Reply With Quote
  #10 (permalink)  
Old 03-29-2007, 10:43 AM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Quote:
Originally Posted by harry View Post
Jon,
your anchor text link has been just replaced by simple url of the site; url specified by you has not been edited;
it's all for maintenance purpose.
Oh I see. I thought your forum was throwing a wobbly Harry.
Reply With Quote
  #11 (permalink)  
Old 03-29-2007, 11:25 AM
Member
 
Join Date: Mar 2007
Location: Bristol, UK
Posts: 32
Default

Quote:
Originally Posted by jon123 View Post
One way around the problem you have is to use phpmailer at : <b>phpmailer.sourceforge.net</b>. I use this and it is a fantastic opensource mailing class.

Hi

Thank you very much for everyone's responses. Thank you Jon, phpmailer works perfectly. Plus all the extra features are going to come in very useful.

Thank you again for the help.

Dave
Reply With Quote
  #12 (permalink)  
Old 03-29-2007, 06:58 PM
Senior Member
 
Join Date: Jan 2007
Posts: 939
Default

Hi Dave, you're welcome. Glad you sorted it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:24 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum