Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 31st March 2009, 17:58
Izinyoka Izinyoka is offline
Junior Member
 
Join Date: Feb 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending emails with PHP

When sending emails with PHP, (from looking at the logs) the from address is translated to 'webID'@servername.serverdomain.
But when the email is delivered, the from address looks correct (mailbox@domain).

So here is the example from my log:
amavis[2564]: (02564-02) Passed CLEAN, <web3@websrv1.serverdomain> -> <sales@recipientdomain>, Message-ID: <20090331122742.9E66FF7C24F@websrv1.serverdomain >

So the server domain is not the same as the website sending the email.
I can't even see a reference of the actual domain.

some mail servers will not accept emails like this.

said: 550-Verification failed for <web3@websrv1.serverdomain> 550-The mail server could not deliver mail to web3@websrv1.serverdomain

But if it did a verification on the actual sender domain, it would be fine.

When using Outlook, it does not do this. The address is correct, even when looking at the log.

I had the same thing with ISPconfig2, just cant figure out what it is.
Any help would be much appreciated.
Reply With Quote
Sponsored Links
  #2  
Old 31st March 2009, 18:16
Izinyoka Izinyoka is offline
Junior Member
 
Join Date: Feb 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default -

when looking at the Message source (on an email client once the message has been delivered), its only the 'return-path' that has the translated address, the actual 'from' is the correct email address.
And the message ID is 20090331033304.B98012180AC@websrv1.serverdomain
Reply With Quote
  #3  
Old 31st March 2009, 18:29
Izinyoka Izinyoka is offline
Junior Member
 
Join Date: Feb 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default -

yeah, it seems that the 'return-path' is taken from who delivers the email to postfix which is the user that apache ran the script as.
Seems like there is much discussion about this but no real way to override it.
Reply With Quote
  #4  
Old 31st March 2009, 19:00
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,034
Thanks: 265
Thanked 151 Times in 131 Posts
Default

Sure there is.
Make sure you set a from email address in the header!

PHP Code:
$Name "Me"//senders name 
$email "me@me.tld"//senders e-mail adress 
$recipient "to@to.tld; //recipient 
$mail_body = "
Hello."; //mail body 
$subject = "
The subject of message"; //subject 
$header = "
From". $Name . " <" . $email . ">"; //optional headerfields 
mail($recipient, $subject, $mail_body, $header); 
__________________
Never execute code written on a Friday or a Monday.

Last edited by edge; 31st March 2009 at 19:15.
Reply With Quote
  #5  
Old 31st March 2009, 20:35
Izinyoka Izinyoka is offline
Junior Member
 
Join Date: Feb 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by edge View Post
Sure there is.
Make sure you set a from email address in the header!

PHP Code:
$Name "Me"//senders name 
$email "me@me.tld"//senders e-mail adress 
$recipient "to@to.tld; //recipient 
$mail_body = "
Hello."; //mail body 
$subject = "
The subject of message"; //subject 
$header = "
From". $Name . " <" . $email . ">"; //optional headerfields 
mail($recipient, $subject, $mail_body, $header); 
There is a from address in the header and it is the correct one, but the return-path is the user apache is running as @ the server domain, not the actual hosted website's domain.
And when the recipient mail server validates the email, it validates the return-path, not the from address.

I understand this is how a normal Unix mail system would work. A user sends a mail, it uses the username @ domain, there is no seperate email field.

I have been working on this issue on and off for almost 2 years... I doubt its going to be as simple as that.
Reply With Quote
  #6  
Old 1st April 2009, 02:48
make-fun make-fun is offline
Member
 
Join Date: Jan 2008
Posts: 92
Thanks: 8
Thanked 8 Times in 7 Posts
Default

You may wanna try the so called "fifth parameter" or "5th parameter" of the mail function…
PHP Code:
$myParam "-f ".$email;
mail($mailto$subject$message$headers$myParam)) 
Cheers
Reply With Quote
Reply

Bookmarks

Tags
email, maildomain, php email, sendmail

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 17:26
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 13:06
ispconfig php 5 errors itamarjp Installation/Configuration 8 25th April 2008 10:20
network issues now it says "401 The web site is blocked by administrator" Check General 3 26th February 2008 14:22
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 16:15.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.