LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-07-2022, 01:56 AM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
How do I setup postfix to act as an email client, so when I send mail to it, it goes through another server?


Basically I want to make it so that if I use the mail command or otherwise send an email via the local mail server, it actually goes through an external mail server. Basically I need to be able to send email from a local computer but I don't want it to keep getting marked as spam because it's coming directly from the computer.

I currently don't have a mail server setup myself online but do have a shared host, so trying to route mail through there. I found a tutorial on how to do it and ended up with the following config in mail.conf:

Code:
relayhost = [sharedhost]:465
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/postfix/certificate.pem
smtp_use_tls = yes
I also created the sasl_passwd file as follows:

Code:
[shardhost]:465 username:password
I then ran postmap command on that file.

However when I try to send an email I end up with an error in the log:

Code:
(delivery temporarily suspended: lost connection with sharedhost[1.2.3.4] while receiving the initial server greeting)
So something is still wrong. Any other parameter or step I may have missed?

Last edited by Red Squirrel; 05-07-2022 at 01:58 AM.
 
Old 05-07-2022, 02:13 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

any particular reason you are using postfix? exim4 is the default mta on Debian and can be easily configured to do this (send via a smarthost).

Evo2.
 
Old 05-07-2022, 02:35 AM   #3
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
It's already setup so it's just easier and that's what I've always used so I'm at least a tad familiar with it. This is an old CentOS 6.10 box that's no longer being updated (the yum repos are dead) so trying to install something else would be more of a pain than it's worth.

Though if it's not easy to do, my plan B is to modify my application to use a separate client like mailx instead of connecting to the local server directly. From quick google search it looks like I can specify external mail server with that command. So rather than have my app send the mail directly to localhost via tcp socket I can just have it write to a file and then have a separate script that looks for files then uses mailx to send the mail.
 
Old 05-07-2022, 04:35 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by Red Squirrel View Post
It's already setup so it's just easier and that's what I've always used so I'm at least a tad familiar with it. This is an old CentOS 6.10 box that's no longer being updated (the yum repos are dead) so trying to install something else would be more of a pain than it's worth.
Ahh, ok. You didn't say what OS this was, and your profile only lists Debian (and a derivative) so assumed that is what you were using.

Evo2.
 
Old 05-07-2022, 06:19 PM   #5
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Yeah forgot to mention, I guess the config syntax, file locations etc does change a lot between distros.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make postfix send email to another postfix in local network (LAN)? h4k33m Linux - Server 9 06-04-2015 04:33 PM
Mail Server with : Postfix,dovecot. (Can send email, but can't receive email from internet mail) cparapat Linux - Server 1 08-16-2010 12:57 AM
Command based email client to send email through secure smtp havolinec Linux - Newbie 2 07-27-2010 07:40 AM
command line email client to send mail to remote mail server dhanju Linux - Software 1 03-07-2008 06:37 AM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:56 AM.

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