Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i followed this tutorial to set up Postfix+Dovecot+postfixadmin on Ubuntu: http://www.exratione.com/2012/05/a-mailserver-on-ubuntu-1204-postfix-dovecot-mysql/

I want to send emails from multiple domains over this server. All domains are pointing to this server anyway.

I set up all the different Domains in postfixadmin and sent an email through smtp everything is fine: (source, received by google)

Delivered-To: xxx@gmail.com
Received: by 10.76.151.101 with SMTP id xxx;
        Fri, 29 Mar 2013 18:41:46 -0700 (PDT)
X-Received: by 10.194.22.5 with SMTP id xxx;
        Fri, 29 Mar 2013 18:41:45 -0700 (PDT)
Return-Path: <xxx@domain2>
Received: from mail.domain1 (domain1. [ip])
        by mx.google.com with ESMTPS id xxx
        (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 29 Mar 2013 18:41:45 -0700 (PDT)
Received-SPF: pass (google.com: domain of xxx@domain2 designates ip as permitted sender) client-ip=ip;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of xxx@domain2 designates ip as permitted sender) smtp.mail=xxx@domain2
Message-ID: <id@domain2>
Date: Sat, 30 Mar 2013 02:41:02 +0100
From: xxx <xxx@domain2>
MIME-Version: 1.0
To: xxx@gmail.com

Now i want php to send emails through postfix:

Delivered-To: xxx@gmail.com
Received: by 10.76.151.101 with SMTP id xxx;
        Fri, 29 Mar 2013 19:08:34 -0700 (PDT)
X-Received: by 10.194.82.104 with SMTP id xxx;
        Fri, 29 Mar 2013 19:08:33 -0700 (PDT)
Return-Path: <www-data@domain1>
Received: from mail.domain1 (domain1. [ip])
        by mx.google.com with ESMTPS id xxx
        (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 29 Mar 2013 19:08:33 -0700 (PDT)
Received-SPF: pass (google.com: domain of www-data@domain1 designates ip as permitted sender) client-ip=ip;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of www-data@domain1 designates ip as permitted sender) smtp.mail=www-data@domain1
Received: by mail.domain1 (Postfix, from userid 33)
    id xxx; Sat, 30 Mar 2013 03:08:32 +0100 (CET)
To: xxx@gmail.com
X-PHP-Originating-Script: 33:class-phpmailer.php
From: name <xxx@domain2>
Message-ID: <id@domain2>
X-Priority: 3
X-Mailer: PHPMailer 5.2.1 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0

domain1 = postfix's sending domain domain2 = the domain in the name of which I want to send the mail

Sending through smtp is just fine, but sending through php gets my emails into gmails spam folder. Gmail says "E-Mail from domain2 over domain1 typical spam".

How can I configure php/postfix that emails through php get send properly in the name of domain2?

Thank you very much!

share|improve this question
    
What does your php code that sends the mail look like? I've been reading the source code for php mailer, and it looks as if it should use the same value as Return-Path (i.e. MAIL FROM in the SMTP protocol) as it does for the From:- header. –  Jenny D Mar 30 '13 at 10:13
    
This is a test e-mail from wordpress. –  pythonimus Mar 30 '13 at 12:33
    
I was asking for the actual PHP code, not for the email... –  Jenny D Mar 30 '13 at 13:01
    
if there is no way to configure postfix/php to override automaticaly the return-path etc. with the from email, then i will use SMTP for php emails, too. I don't want to tweak on the source of my scripts. –  pythonimus Mar 30 '13 at 14:00
    
If you're unwilling to show how the mails are actually being sent, then there is no way for me to help you figure out what needs to be tweaked. –  Jenny D Mar 30 '13 at 14:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.