0

I need to collect emails from ISP mailserver and send it to internal mailserver. i'm trying to do this, using additional mail transfer server, Debian linux with Fetchmail as downloader and Exim as MTA.

Internal mailserver is old legacy MS Exchange and can't be replaced at this time.

receiving emails directly with Exim as SMTP server, everything works just fine.

with fetchmail, it downloads mail from ISP, but replacing recipient at SMTP RCTP command.

to MTA server local user@hostname, when sending it to Exim:

SMTP> MAIL FROM:<user@domain.com> SIZE=707
SMTP< 250 2.1.0 user@domain.com....Sender OK
SMTP> RCPT TO:<root@localhost>

or user@IP if sending direct to internal mail server bypassing exim , with fetchmail -S [address] option:

SMTP> RCPT TO:<root@192.168.220.25>

for this reason, internal mail server not delivering email to user, even with correct TO: header, placing it to unknown address box.

when running fetchmail with option --smtpname [myuser@mydomain.com] , RCPT have correct address, but i'm not figured out how this can be done automatically for each message

Thanks.

EDIT: no answers so far, so i've made a workaround:

edited .fetchmailrc config file

mda="./testmta"

testmta is a bash script processing message from stdin, finding to: address and sending with ssmtp:

cat >/tmp/fetchmail.msg
TO=`cat /tmp/fetchmail.msg | grep -m1 To: | sed 's|To: ||'`
/usr/sbin/ssmtp $TO < /tmp/fetchmail.msg

internal mail server address at /etc/ssmtp/ssmtp.conf

voe
  • 1
  • 1

0 Answers0