LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-28-2020, 11:48 PM   #1
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Rep: Reputation: 21
Postfix SMTP Relay for multiple domains


Hi there,

So, I've been spending some time setting up a Postfix-Dovecot mail server on my local network, solely for personal use. I have setup virtual users & domains in a Postgres database and everything seems to be running well; I can send and receive messages on an internal domain, and have fetchmail pulling messages from my existing email accounts hosted elsewhere (ISP, hosting provider, Gmail, etc). So far so good.

Now I want to be able to send messages for those 'elsewhere' accounts, THROUGH the existing smtp servers that I've been using up to this point in Thunderbird; I just want it to be relayed/routed through my postfix smtp to my hosting provider's smtp (in this instance; eventually I'll do the same thing for my ISP and Gmail. For now I just want to be able to send mail for mydomain.com through the smtp server of my hosting provider)

From what I've read, smtp relay is what does this, am I correct?


So I've added the following settings to my postfix main.cf:
Code:
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwd
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
relayhost =
Note that 'relayhost' is left blank. I'm not sure what to put there.


I've added my external account username/password to smtp_sasl_passwd:
Code:
@mydomain.com    me@mydomain.com:mypassword
and I've added my external smtp servers to sender_relay:
Code:
@mydomain.com   smtp.myhostingprovider.com:587
I ran postmap on both smtp_sasl_passwd and sender_relay, and restarted my postfix service. Everything seemed to come up fine.

So I went to Thunderbird and sent an email to my Gmail account from my 'mydomain.com' account that I setup on my internal postfix server.
It appeared to send, but I never received it in my Gmail account.

So I took a look at 'postqueue' and noticed that it's stuck in there.
It says:
Code:
"delay_reason": "connect to alt4.gmail-smtp-in.l.google.com[142.250.XX.XX]:25: Connection timed out"
I'm a bit confused.
Why is postfix trying to connect to the google smtp if my intention was to relay the message from my postfix smtp to myhostingprovider.com?

I feel like I'm missing something, or perhaps I'm misunderstanding relay altogether.
Can someone help shed some light on how this should be configured to achieve what I'm trying to do?

Much appreciated!
 
Old 01-01-2021, 06:45 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,147

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
I'm no postfix expert but if you want to relay all of your mail it should use relayhost.
 
Old 01-20-2021, 03:56 AM   #3
Rawcous
Member
 
Registered: Jan 2014
Location: Farnborough, Hampshire - UK
Distribution: SCO UNIX -> Fedora (Core) -> CentOS -> RedHat
Posts: 128

Rep: Reputation: 48
Hello,

As per "SmallPond" i'm no Postfix oficionado as I use Sendmmail / Dovecot but I believe you need to set the "relayhost" to your ISP's SMTP server i.e. smtp.ISPMailServer.Com

Regards,

Rawcous
 
  


Reply

Tags
email, postfix, smtp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix Multiple SMTP Relay contertulio Linux - Server 0 02-06-2013 10:44 AM
Configure Postfix to relay mail to multiple internal mail servers w/different domains tristopherr Linux - Server 2 05-08-2011 06:23 AM
Multiple emails accounts(with different from domains) on multiple domains on 1 server locoputo Linux - Server 0 04-12-2009 06:29 PM
Postfix relay access denied multiple domains metalenkist Linux - Server 16 02-21-2008 02:43 PM
SMTP "open relay" and SMTP AUTH aikempshall Linux - Security 3 10-11-2006 08:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration