Page 1 of 2

Using sendmail to forward email to mail.sonic.net

Posted: Sun Aug 25, 2013 10:19 am
by rtcary
By chance, does anyone on this forum have experience in setting up Linux sendmail to forward outgoing emails through mail.sonic.net?

With appreciation...

Todd

Re: Using sendmail to forward email to mail.sonic.net

Posted: Wed Aug 28, 2013 10:00 pm
by kgc
Todd, this is easy to do if you haven't already gotten it working.

If you are cf hacking -

Code: Select all

# "Smart" relay host (may be null)
DS[mail.sonic.net]
Or in the .mc

Code: Select all

define(`SMART_HOST',`[mail.sonic.net]')dnl
You want to put the hostname inside of square bracket to prevent sendmail from doing MX lookups on the hostname and using them instead - it amounts to the same but creates some extra DNS traffic.

Re: Using sendmail to forward email to mail.sonic.net

Posted: Thu Jan 23, 2014 9:48 am
by boris_r
Although the /var/log/maillog records read “Message accepted for delivery”, those messages are never delivered. All other information pertained to each mail transaction, looks correct.

The sendmail.mc contains define(`SMART_HOST',`[mail.sonic.net]')dnl statement. Ports 25, 465, 587 of the 4111N modem firewall are open.

The environment is unchanged; sendmail in RH 7.3 (worked with the previous ISP > 12 years)

Can anyone comment on the problem?

Re: Using sendmail to forward email to mail.sonic.net

Posted: Thu Jan 23, 2014 10:55 am
by kgc
If they are never delivered and you never receive a DSN, there is most likely an addressing problem. If you send a note to support with an example of an affected message, they should be able to figure out what happened.

You're looking for this line in the logs -- make sure that you give them the queueid of the accepted message.

Jan 23 03:02:29 meno sm-mta[48744]: s0NB2S8k048743: to=[email protected], ctladdr=<[email protected]> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=33711, relay=mail.sonic.net. [64.142.7.162], dsn=2.0.0, stat=Sent (s0NB2S1i008054 Message accepted for delivery)

s0NB2S1i008054 is the queueid.

Re: Using sendmail to forward email to mail.sonic.net

Posted: Thu Jan 23, 2014 1:17 pm
by boris_r
thanks; I did it

Re: Using sendmail to forward email to mail.sonic.net

Posted: Fri Jan 24, 2014 5:29 pm
by cdkeen
Instructions for configuring sendmail to use mail.sonic.net for relay with SMTP authentication on Debian/Ubuntu Linux
(Modified from source: http://superuser.com/questions/570742/s ... y-port-465)

Enter valid fully qualified domain name if not set:
/etc/hostname

Install packages:
apt-get install sendmail sendmail-cf sasl2-bin

Create and Configure:
cd /etc/mail

mkdir certs

chmod 700 certs/

cd certs/

openssl dsaparam 1024 -out dsa1024.pem

openssl req -x509 -nodes -days 3650 -newkey dsa:dsa1024.pem -out /etc/mail/certs/mycert.pem -keyout /etc/mail/certs/mykey.pem
Enter "US" for Country Name (Can leave everything else blank)

openssl req -x509 -new -days 3650 -key /etc/mail/certs/mykey.pem -out /etc/mail/certs/mycert.pem
Enter "US" for Country Name (Can leave everything else blank)

ln -s /etc/mail/certs/mycert.pem /etc/mail/certs/CAcert.pem

chmod 600 /etc/mail/certs/*

cd ..

mkdir auth

chmod 700 auth/

vim auth/client-info
Add these lines changing out username/password:
(Hit 'i' to insert)
AuthInfo:mail.sonic.net "U:SONICUSR" "I:[email protected]" "P:PASSWORD"
AuthInfo: "U:SONICUSR" "I:[email protected]" "P:PASSWORD"
(:wq to write and quit)

makemap -r hash /etc/mail/auth/client-info.db < /etc/mail/auth/client-info

vim /etc/mail/sendmail.mc
Insert the following below MAILER_DEFINITIONS:
(Hit 'i' to insert)

dnl #
dnl # SSL Settings
define(`CERT_DIR', `MAIL_SETTINGS_DIR`'certs')
define(`confCACERT_PATH', `CERT_DIR')
define(`confCACERT', `CERT_DIR/CAcert.pem')
define(`confSERVER_CERT', `CERT_DIR/mycert.pem')
define(`confSERVER_KEY', `CERT_DIR/mykey.pem')
define(`confCLIENT_CERT', `CERT_DIR/mycert.pem')
define(`confCLIENT_KEY', `CERT_DIR/mykey.pem')
dnl #
dnl # RELAY VIA MAIL.SONIC.NET USING SMTP AUTH
define(`SMART_HOST',`[mail.sonic.net]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/auth/client-info.db')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

(:wq to write and quit)

m4 sendmail.mc > sendmail.cf

service sendmail stop

service saslauthd start

service sendmail start

(echo subject: test; echo ) | /usr/sbin/sendmail -v -i -Am -- [email protected]

Re: Using sendmail to forward email to mail.sonic.net

Posted: Tue Jan 28, 2014 3:46 pm
by cdkeen
I adapted this configuration to an installation of scientific linux 6; All necessary packages were present already, just omit the steps to install packages and the step to restart sasl and the guide should assist in setting up SMTP authentication for your server using other distros.

Re: Using sendmail to forward email to mail.sonic.net

Posted: Sat Feb 08, 2014 3:09 pm
by MrMaui76
Hi Guys,

Tried setting up postfix and couldn't get anywhere so thought I'd try my hand at this. Using Ubuntu 12.04.3 Server and after following the instructions posted by cdkeen, the error that I'm being presented with says...

553 5.1.8 <[email protected]>... Domain of sender address [email protected] does not exist

Any thoughts?

Re: Using sendmail to forward email to mail.sonic.net

Posted: Sun Feb 09, 2014 11:45 pm
by kgc
You must send mail from a valid fully qualified domain name that exists in DNS.

Re: Using sendmail to forward email to mail.sonic.net

Posted: Wed Feb 12, 2014 4:21 pm
by oddhack
MrMaui76 wrote:Hi Guys,

Tried setting up postfix and couldn't get anywhere so thought I'd try my hand at this.
I've been running postfix as the MTA with mail.sonic.net upstream for years on my Ubuntu / Debian machines. If you want I'll pass along the configuration tweaks I made (I find sendmail configuration almost completely incomprehensible and postfix only semi-incomprehensible, so prefer the latter).