0

I am not very good with email servers. Here is what I need:

I have a mailbox at fastmail.com with my custom domain (let's call it example.com). Now I want to set up my web server to relay emails through fastmail.com (I have their mx records in hand) and the no reply email address to be bot@example.com. I want to use sendmail to achieve this.

When I tried to send an email using sendmail, here is the log I got:

to=_myemailaddress_, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30088, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

(myemailaddress being my own email address).

The relay server here is 127.0.0.1, which doesn't seem right. So, I digged and found the two files /var/mail/submit.cf and /var/mail/sendmail.cf. Then I searched for the line with the text "127.0.0.1":

// submit.cf
FEATURE(`msp', `[127.0.0.1]', `25')dnl

// sendmail.cf
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl

Should I change the addresses to fastmail MX records (in1-smtp.messagingengine.com, in2-smtp.messagingengine.com)?

Or should I do something else?

2

Sendmail requires root privileges for some actions. Modern installations avoid being set root is by passing messages to sendmail daemon running with root privileges at 127.0.0.1:25.

Your local sendmail daemon does not seem to be up and running.

  1. Check sendmail log files for any startup problems (log file names are OS/Distribution depended (e.g. /var/log/mail.log on Linux/Debian)

  2. Start/restart sendmail daemon (procedure OS/Distribution dependent)

  • Thank you! I reatarted sendmail and relays are set up correctly. However, there is one more issue. The emails are going as root@example.com, which makes me think that the mails happen this way because the server is started on root. Is there a way to change this through sendmail config. Or should I create a new account with root privileges and run the server through them? – Gasim Jul 29 '15 at 16:15
  • Have you tried to send email as non root user with the same effect? Do you have public STATIC ip address? – AnFi Jul 29 '15 at 18:28
  • Running from web sends it over www-data@exampld.com (the nginx user) but I want to have a different user for www-data without changing user's name to "bot". Yes I do have a static IP. It is on a server. – Gasim Jul 29 '15 at 19:25
  • 1
    You have two choices: a) reconfigure your web-app to send emails as different user (Do you use php/....?) b) reconfigure sendmail to rewrite www-data@exampld.com email address in envelope sender and headers to another email address [It can be done using FEATURE(genericstable) - ask another question to get more details – AnFi Jul 29 '15 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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