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

I have configures sendmail to send email via my GMail (Google Mail) account, i.e. via smtp.gmail.com, by editing /etc/mail/sendmail.mc and regenerating sendmail.cf:

-dnl define(`SMART_HOST',`smtp.your.provider')
+define(`SMART_HOST',`[smtp.gmail.com]')

-dnl define(`confAUTH_OPTIONS', `A p')dnl
+define(`confAUTH_OPTIONS', `A p')dnl

-dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
-dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')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(`no_default_msa',`dnl')dnl
 FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
+FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')dnl
 FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
 FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl

-dnl MASQUERADE_AS(`mydomain.com')dnl
+MASQUERADE_AS(`gmail.com')dnl

Above is shortened diff of my changes to sendmail.mc.

I have created /etc/mail/authinfo with my credentials (username and password for my GMail account; redacted):

AuthInfo:smtp.gmail.com "U:user@gmail.com" "P:password" "M:PLAIN"
AuthInfo: "U:user@gmail.com" "P:password" "M:PLAIN"

But this setup makes 'sendmail' send emails via standard SMTP port 25 using smtp.gmail.com... but lately my ISP added firewall rule which blocks all traffic to (insecure) port 25.

How to configure sendmail to send emails via port 465 or 587 (using STARTTLS)?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Add the following to your sendmail.mc:

define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS’, `TCP $h 587′)

That should get your outbound mail being sent by Sendmail on port 587.

You'll also need to have sendmail configured to do TLS. It's a bit beyond the scope of your question, but you can find a lot of decent guides about how to do it w/ Google if you're not familiar.

share|improve this answer

Your Answer

 
discard

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.