Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 24th August 2007, 20:03
stirfry stirfry is offline
Join Date: Jun 2007
Posts: 37
Thanks: 4
Thanked 0 Times in 0 Posts
Default Problems with PHP mail() function

Sorry in advance for the long post, but I want to make sure I include all relevant info.

I've been using one of the webmail apps (UebiMiau) that comes with ISPConfig and it works just fine. However, I'm having two different problems with using the PHP mail() function on my websites at IP addresses which are different from the IP that ISPConfig runs on. These two problems may or may not be related to each other, so I'll describe them both here just in case.

The first problem has to do with the way mail is handled when I do a simple test with the PHP mail() function. I run this script from one of my virtual sites (email addresses changed to protect against SPAM):

$to = "recipient@example.com";
$subject = "Nonsensical Latin";

// compose headers
$headers = "From: sender@myVirtualSite.com\r\n";
$headers .= "Reply-To: sender@myVirtualSite.com\r\n";
$headers .= "X-Mailer: PHP/".phpversion();

// compose message
$message = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
$message .= " Nam iaculis pede ac quam. Etiam placerat suscipit nulla.";
$message .= " Maecenas id mauris eget tortor facilisis egestas.";
$message .= " Praesent ac augue sed enim aliquam auctor. Ut dignissim ultricies est.";
$message .= " Pellentesque convallis tempor tortor. Nullam nec purus.";
$message = wordwrap($message, 70);

// send email
mail($to, $subject, $message, $headers);

After running it, I always get new mail in my system mailbox (/var/mail/shaun ... not /var/mail/www-data). This is what it says:

From www-data@myISPconfigSite.com  Fri Aug 24 09:37:12 2007
Return-Path: <www-data@myISPconfigSite.com>
X-Original-To: recipient@example.com
Delivered-To: recipient@example.com
Received: by server1.sdellis.com (Postfix, from userid 33)
        id DBCA63588001; Fri, 24 Aug 2007 09:37:12 -0500 (CDT)
To: recipient@example.com
Subject: Nonsensical Latin
From: sender@myVirtualSite.com
Reply-To: sender@myVirtualSite.com
X-Mailer: PHP/5.1.6
Message-Id: <20070824142812.DBCA63588001@server1.myISPconfigSite.com>
Date: Fri, 24 Aug 2007 09:37:12 -0500 (CDT)

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam iaculis
pede ac quam. Etiam placerat suscipit nulla. Maecenas id mauris eget
tortor facilisis egestas. Praesent ac augue sed enim aliquam auctor.
Ut dignissim ultricies est. Pellentesque convallis tempor tortor.
Nullam nec purus.

My mail.log:

Aug 24 09:37:54 postfix/pickup[1329]: 48BE63588001: uid=33 from=<www-data>
Aug 24 09:37:54 postfix/cleanup[5893]: 48BE63588001: message-id=<20070824143754.48BE63588001@server1.myISPconfigSite.com>
Aug 24 09:37:54 postfix/qmgr[28463]: 48BE63588001: from=<www-data@myISPconfigSite.com>, size=661, nrcpt=1 (queue active)
Aug 24 09:37:54 postfix/local[5895]: 48BE63588001: to=<recipient@example.com>, relay=local, delay=0.04, delays=0.02/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Aug 24 09:37:54 postfix/qmgr[28463]: 48BE63588001: removed
As you can see from the above log output, the status is "sent", but I can't tell if it's bouncing back or if it's going directly into my system mailbox.

I think I understand what's going on with my second problem, but I don't know how to fix it. One another site (at a different IP), I'm using HTML Mime Mail (http://www.phpguru.org/static/htmlMimeMail5.html) and I keep seeing messages in the www-data system user's mailbox that look like this:

<someuser@verizon.net>: host relay.verizon.net[] said: 550
    5.1.8 invalid/host-not-in-DNS return address not allowed (in reply to MAIL
    FROM command)

Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; server1.myISPconfigSite.com
X-Postfix-Queue-ID: ED2F45D9076
X-Postfix-Sender: rfc822; www-data@server1.myISPconfigSite.com
Arrival-Date: Sat,  4 Aug 2007 17:20:50 +0000 (UTC)

Final-Recipient: rfc822; someuser@verizon.net
Action: failed
Status: 5.1.8
Remote-MTA: dns; relay.verizon.net
Diagnostic-Code: smtp; 550 5.1.8 invalid/host-not-in-DNS return address not

Content-Description: Undelivered Message
Content-Type: message/rfc822

I have 3 public IP's. One IP is for an e-commerce site which requires SSL, the other IP is for ISPConfig/my site, and the last IP is for virtual hosting of basic PHP-enabled web sites. I assume that webmail works because webmail sends from the ISPConfig IP and passes the DNS lookup test, but when mail is sent from PHP scripts running at a different IP, it fails the DNS lookup and bounces back.

Does anyone know how I can fix this so the PHP mail() function works AND passes the host/DNS test?
Reply With Quote
Sponsored Links
Old 25th August 2007, 17:16
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,751 Times in 2,581 Posts

You can try to bind Postfix to one IP address with the smtp_bind_address parameter.
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote


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
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 10:29
Apache2 Freezes celtic Server Operation 31 28th May 2007 18:18
SuSE Enterprise, PHP binary coming with ISPConfig does not work properly NexusTechUS Installation/Configuration 1 26th April 2007 21:03
Core 4: Error Messages on Fresh Install re CTX/SSL jjw Installation/Configuration 30 6th September 2006 13:16
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs ebbay Installation/Configuration 9 4th March 2006 12:47

All times are GMT +2. The time now is 04:18.

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