Mail relay to outside using postfix

Megabyte

Joined
Mar 28, 2009
Messages
327
Likes
0
Points
0
#1
Hi, i was looking into the forums an i saw many solutions about sending emails to an outside host, i mean using an external email address as a relay host. i did it using a great script posted by ramoncio but i cant ge it working i tried with three diferents providers, maybe im doing something wrong, i want to be able to send to hotmail and yahoo account using my domain ji.gov.do, i have an account there, amunoz@ji.gov.do.

Look this is how the script looks like

#!/bin/bash
relayhost=mail.ji.gov.do
username=amunoz.ji.gov.do
password=XXXXX
echo "$relayhost $username:$password" >> /etc/postfix/sasl_passwd
chown root:root /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
echo "relayhost = $relayhost" >> /etc/postfix/main.cf
echo "smtp_sasl_auth_enable = yes" >> /etc/postfix/main.cf
echo "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" >> /etc/postfix/main.cf
service postfix restart



this is how main.cf looks like


relayhost = mail.ji.gov.do
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd




this is how sasl_passwd looks like

mail.ji.gov.do amunoz.ji.gov.do:XXXX







And this is my postfix logs output


Aug 23 17:13:39 elastix postfix/pickup[10811]: 2531F688779: uid=100 from=<asterisk>
Aug 23 17:13:39 elastix postfix/cleanup[10832]: 2531F688779: message-id=<20090823211339.2531F688779@elastix.example.com>
Aug 23 17:13:39 elastix postfix/pickup[10811]: 2C4F5688778: uid=100 from=<asterisk>
Aug 23 17:13:39 elastix postfix/qmgr[10812]: 2531F688779: from=<asterisk@example.com>, size=404, nrcpt=1 (queue active)
Aug 23 17:13:39 elastix postfix/cleanup[10832]: 2C4F5688778: message-id=<Asterisk-6-1218537960-2505-2721@elastix.example.com>
Aug 23 17:13:39 elastix postfix/qmgr[10812]: 2C4F5688778: from=<asterisk@example.com>, size=9561, nrcpt=1 (queue active)
Aug 23 17:13:40 elastix postfix/smtp[10838]: warning: SASL authentication failure: No worthy mechs found
Aug 23 17:13:40 elastix postfix/smtp[10837]: warning: SASL authentication failure: No worthy mechs found
Aug 23 17:13:40 elastix postfix/smtp[10838]: 2C4F5688778: to=<alfiomunoz@hotmail.com>, relay=mail.ji.gov.do[66.128.49.218]:25, delay=0.95, delays=0.15/0.02/0.79/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server mail.ji.gov.do[66.128.49.218]: no mechanism available)
Aug 23 17:13:40 elastix postfix/smtp[10837]: 2531F688779: to=<alfiomunoz@gmail.com>, relay=mail.ji.gov.do[66.128.49.218]:25, delay=0.96, delays=0.08/0.03/0.85/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server mail.ji.gov.do[66.128.49.218]: no mechanism available)






I tried with three providers same configs, same errors, if someone can see what im doing wrong i will apreciated. thx.
 

ramoncio

Joined
May 12, 2010
Messages
1,663
Likes
0
Points
0
#2
This script won't work for gmail, hotmail, yahoo... it is just for servers that don't require secure sasl smtp authentication, just plain text.
Search the forums, there is other script to setup your gmail accout. Maybe you can modify it to use it with other providers that use more advanced sasl mechanisms.
 

Megabyte

Joined
Mar 28, 2009
Messages
327
Likes
0
Points
0
#3
Im trying to others providers, not gmail or hotmail or yahoo, im trying to send to amunoz@aiatek.com.do using amunoz@ji.gov.do.

Aug 23 18:51:01 elastix postfix/pickup[11509]: A4CF0688775: uid=100 from=<asterisk>
Aug 23 18:51:01 elastix postfix/cleanup[11532]: A4CF0688775: message-id=<20090823225101.A4CF0688775@elastix.example.com>
Aug 23 18:51:01 elastix postfix/pickup[11509]: AC0BF688733: uid=100 from=<asterisk>
Aug 23 18:51:01 elastix postfix/qmgr[11510]: A4CF0688775: from=<asterisk@example.com>, size=404, nrcpt=1 (queue active)
Aug 23 18:51:01 elastix postfix/cleanup[11535]: AC0BF688733: message-id=<Asterisk-8-2068492561-2505-2721@elastix.example.com>
Aug 23 18:51:01 elastix postfix/qmgr[11510]: AC0BF688733: from=<asterisk@example.com>, size=9381, nrcpt=1 (queue active)
Aug 23 18:51:02 elastix postfix/smtp[11536]: warning: SASL authentication failure: No worthy mechs found
Aug 23 18:51:02 elastix postfix/smtp[11537]: warning: SASL authentication failure: No worthy mechs found
Aug 23 18:51:02 elastix postfix/smtp[11536]: A4CF0688775: to=<amunoz@aiatek.com.do>, relay=mail.ji.gov.do[66.128.49.218]:25, delay=1.1, delays=0.25/0.02/0.84/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server mail.ji.gov.do[66.128.49.218]: no mechanism available)
Aug 23 18:51:02 elastix postfix/smtp[11537]: AC0BF688733: to=<amunoz@aiatek.com.do>, relay=mail.ji.gov.do[66.128.49.218]:25, delay=1, delays=0.23/0.02/0.8/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server mail.ji.gov.do[66.128.49.218]: no mechanism available)
 

Megabyte

Joined
Mar 28, 2009
Messages
327
Likes
0
Points
0
#4
Thx Ramoncio i found a solution, i now i can send using gmail account but your scrit its very nice and very helpfull i hope you continue making things like this
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,913
Messages
130,917
Members
17,589
Latest member
cristian.saiz
Top