Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a machine with two domain names, say and

When I use postfix to send something from an address like, it replaces it with every time. My file specifies only so I don't know where the is coming from.

Here's the relevant part of maillog... the first line is the intiation of the message and then the 6th line is the one where mysteriously pops up.

mymachine sendmail[28543]: qA3NGbOR028543:, size=792, class=0, nrcpts=1, msgid=<>, relay=apache@localhost
mymachine postfix/smtpd[28546]: connect from[]
mymachine postfix/smtpd[28546]: 912F9758031:[]
mymachine postfix/cleanup[28549]: 912F9758031: message-id=<>
mymachine sendmail[28543]: qA3NGbOR028543:, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30792, relay=[] [], dsn=2.0.0, stat=Sent (Ok: queued as 912F9758031)
mymachine postfix/qmgr[28527]: 912F9758031: from=<>, size=1130, nrcpt=1 (queue active)

I'm not sure if it's relevant how I called this, but it's from some PHP mail() and I've ensured the -f flag is passed along. If any more info might help I'd be happy to deliver it!

share|improve this question
I also found this which is a similar problem, but was not answered:… – daveagp Nov 3 '12 at 23:47


I found it was easier just to uninstall sendmail, install postfix, and use a Python script to send the mail. Here is the Python 3 code which I used to send the message (it needed to be internationalized hence the UTF-8 encodings).

import email.message, email.mime.text, smtplib, sys
from email.utils import parseaddr, formataddr
from email.header import Header
from email.charset import Charset

def format_address(name, email):
    if not name:
        return email
    name = Charset('iso-8859-1').header_encode(name)
    return formataddr((name, email))

def send_unicode_email(mFrom, mTo, mSubject, mBody):
    sender_name, sender_addr = parseaddr(mFrom)
    recipient_name, recipient_addr = parseaddr(mTo)

    composed = email.mime.text.MIMEText(mBody.encode('UTF-8'), _charset='UTF-8')
    composed['from'] = format_address(sender_name, sender_addr)
    composed['to'] = format_address(recipient_name, recipient_addr)
    composed['subject'] = Header(mSubject, 'UTF-8')

    srv = smtplib.SMTP('localhost')
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.