IMPORTANT NOTE:
|
Please make sure that this will NOT act as a smtp server instead it will send mails using smtp.gmail.com. You will be able to send mails on any address over the internet using your local linux box mail address but you won't be able to receive any of the mails from outside domain.
|
NOTE: This is a simple configuration but if you want to insert some special permissions and authentications let me know I will try to help with additional info.
To start of with the configuration initially you need to check for the presence of STARTLS and SASLv2 in your machine.
# sendmail -d0.1 -bv root
Version 8.13.8
Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS
TCPWRAPPERS USERDB USE_LDAP_INIT
============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = server
(canonical domain name) $j = server.example.com
(subdomain name) $m = example.com
(node name) $k = server.example.com
========================================================
# yum -y install sendmail
# rpm -qa | grep sendmail
sendmail-cf-8.13.8-2.el5
sendmail-8.13.8-2.el5
make sure that you install sendmail-cf because while mapping sendmail.mc into sendmail.cf you need sendmail-cf as mentioned in the configuration file
# vi /etc/mail/sendmail.mc
define(`SMART_HOST', `smtp.gmail.com')dnl
# (add these two lines in your sendmail.mc file to listen on port 465 and 587)
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
# uncomment this line
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
# add this line
FEATURE(`authinfo', `hash /etc/mail/auth/client-info.db')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
# uncomment for sendmail to listen on port 587
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
# uncomment for sendmail to listen on port 587
DAEMON_OPTIONS(`Port=smtps, Name=TLSMTA, M=s')dnl
# write your domain and uncomment
MASQUERADE_AS(`mydomain.com')dnl
Make a directory auth inside /etc/mail and assign proper permissions to auth so that no other user can access this directory
# mkdir /etc/mail/auth
# cd /etc/mail/auth
Create a new file client-info
AuthInfo:gmail.com "U:username" "P:Password" "M:PLAIN"
AuthInfo: "U:username" "P:Password" "M:PLAIN
# makemap -r hash client-info.db < client-info
# vi /etc/mail/access
Connect:your-ip RELAY
# m4 sendmail.mc > sendmail.cf
# service sendmail restart
# sendmail -v user@domain.com
NOTE: If you get any error message or you are unable to send mails even after following the above configuration kindly revert back with the log messages so that I can help you further for the same.
Actually i am trying to send the email from Redhat 5.5 to some gmail IDs,, But it throws the error..
It can be good if you can help..
Error:
stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com
My otrs is not sending notifications to outlook 365. Receiving following error
—– The following addresses had permanent fatal errors —–
—– Transcript of session follows —–
… Deferred: Connection timed out with domain-ac-in.mail.protection.outlook.com.
Message could not be delivered for 5 days
Message will be deleted from queue
Hi I am getting below given error
# sendmail -v user@crestel.indinet.co.in
WARNING: local host name (EMSREPSEC) is not qualified; see cf/README: WHO AM I?
crestel.indinet.co.in: Name server timeout
user@crestel.indinet.co.in… Transient parse error — message queued for future delivery
hi,
Hi,
I have followed the above steps as you said. but i didnt receive mail.
Please help me to fix the issue
[root@linux2 mqueue]# echo "helloooo" | sendmail -v karthis2020[at]gmail.com
WARNING: local host name (linux2) is not qualified; see cf/README: WHO AM I?
karthis2020[at]gmail.com… Connecting to [127.0.0.1] via relay…
220 linux2 ESMTP Sendmail 8.13.8/8.13.8; Fri, 3 Mar 2017 14:52:18 +0530
>>> EHLO linux2
250-linux2 Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> MAIL From: SIZE=9 AUTH=root@linux2
250 2.1.0 … Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 … Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 v239MIWF007609 Message accepted for delivery
karthis2020[at]gmail.com… Sent (v239MIWF007609 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
Hi
Thanks for this info.
I have followed the steps, but I get this error:
NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: cannot bind: Address already in use
You seem to have 587 listed twice, even though the comments are are 465 and 587.
Can you confirm ?
I have configure sendmail as shown above and keep greeting this in /var/spool/mail/root…
Please help/
The original message was received at Mon, 31 Oct 2022 09:52:19 -0400
from localhost [127.0.0.1]
—– The following addresses had permanent fatal errors —–
(reason: 550 Host unknown)
—– Transcript of session follows —–
550 5.1.2 … Host unknown (Name server: ‘smtprelay.massconvention.com’: host not found)
–29VDqJ4I941903.1667224339/bcec-syslog-01.staff.mccanet.com
Content-Type: message/delivery-status
Reporting-MTA: dns; bcec-syslog-01.staff.mccanet.com
Received-From-MTA: DNS; localhost
Arrival-Date: Mon, 31 Oct 2022 09:52:19 -0400
Final-Recipient: RFC822; jbatista@signatureboston.com
Action: failed
Status: 5.1.2
Remote-MTA: DNS; ‘smtprelay.massconvention.com’
Diagnostic-Code: SMTP; 550 Host unknown
Last-Attempt-Date: Mon, 31 Oct 2022 09:52:19 -0400
–29VDqJ4I941903.1667224339/bcec-syslog-01.staff.mccanet.com
Content-Type: message/rfc822
Return-Path:
Received: from bcec-syslog-01.staff.mccanet.com (localhost [127.0.0.1])
by bcec-syslog-01.staff.mccanet.com (8.15.2/8.15.2) with ESMTPS id 29VDqJ4H941903
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT)
for ; Mon, 31 Oct 2022 09:52:19 -0400
Received: (from root@localhost)
by bcec-syslog-01.staff.mccanet.com (8.15.2/8.15.2/Submit) id 29VDqCDL941898
for jbatista@signatureboston.com; Mon, 31 Oct 2022 09:52:12 -0400
Date: Mon, 31 Oct 2022 09:52:12 -0400
From: root
Message-Id:
test 1
–29VDqJ4I941903.1667224339/bcec-syslog-01.staff.mccanet.com–