Centos – Telling sendmail to auth

centossendmail

I've been sitting here for a few hours now attempting to get sendmail to send the emails through an external SMTP server. I've gotten very close, but now I'm completely stuck. It seems that sendmail isn't sending the authentication information I've set. Is there some configuration line I'm missing?

Please help. 🙁

Running CentOS 5.7

EDIT:

As requested, I'll add a few things from my sendmail here.

Where I've specified to use auth information:

FEATURE(authinfo',hash -o /etc/mail/auth/client-info.db')dnl

/etc/mail/auth/client-info:

AuthInfo:in.mailjet.com "U:myusername" "P:mypassword" "M:PLAIN"

Attempting to send an email:

# sendmail -AM -t -v
to:myemail@gmail.com
from:root@mydomain.com
.
myemail@gmail.com... Connecting to in6.mailjet.com. via relay...
220 in6.mailjet.com ESMTP Mailjet
>>> EHLO mydomain.com
250-in6.mailjet.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO mydomain.com
250-in6.mailjet.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-AUTH=PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
>>> MAIL From:<root@mydomain.com> SIZE=37
250 2.1.0 Ok
>>> RCPT To:<myemail@gmail.com>
>>> DATA
554 5.7.1 <myemail@gmail.com>: Relay access denied
554 5.5.1 Error: no valid recipients
>>> RSET
250 2.0.0 Ok
/root/dead.letter... Saved message in /root/dead.letter
Closing connection to in6.mailjet.com.
>>> QUIT
221 2.0.0 Bye

Best Answer

i had the same issue. Finally made it with several configurations.

/etc/mail/sendmail.mc
    define('SMART_HOST','smtp.yourdomain.com')dnl
    define('confAUTH_OPTIONS','A')dnl
    FEATURE('authinfo','hash -o /etc/mail/authinfo.db')dnl
    MASQUERADE_AS('yourdomain.com')dnl
    FEATURE(masquerade_envelope)dnl
    FEATURE(masquerade_entire_domain)dnl
    MASQUERADE_DOMAIN('yourdomain.com.')dnl
    FEATURE('relay_based_on_MX')dnl
    FEATURE('genericstable')dnl
    GENERICS_DOMAIN('localhost.localdomain')dnl

/etc/mail/authinfo (660 permissions)
    Authinfo:yourdomain.com "U:yoursmtpuserid" "P:yourpassword" "M:PLAIN"
    Authinfo: "U:yoursmtpuserid" "P:yourpassword" "M:PLAIN"

>makemap hash /etc/mail/authinfo < /etc/mail/authinfo

/etc/mail/access (660 permissions)
    connect:localhost.localdomain RELAY
    connect:localhost RELAY
    connect:127.0.0.1 RELAY

>makemap hash /etc/mail/access < /etc/mail/access


/etc/genericstable
    root youruseremail@yourdomain.com

>makemap hash /etc/mail/genericstable < /etc/mail/genericstable


/etc/named.conf
    options{
          listen-on port 53 {127.0.0.1;};
    };

>cp -f /etc/named.conf /var/named/chroot/etc/

/etc/resolve.conf
    nameserver  127.0.0.1
    nameserver  youriplocal
    domain      localdomain

>chkconfig -> named on
          -> saslauthd on
          -> sendmail on

>service named restart
>service saslauthd restart
>service sendmail restart

To test it you can execute:

sendmail -Am -t -v to:emaildestination from:youremail

I hope it works for you.

Related Topic