Sending email from command line through authenticated SMTP server
The long story: I am setting up the Hylafax server (which is working now fine) and I want it to be able to email the received faxes to non-local email addresses as attachments.
The short story: How do I send emails from Linux command line through my Email hosting provider's authenticated SMTP server?
Most information on the net either refers to a variety of easy to use command line clients (mailx, mail etc.) which dont's seem to be able to use authentication through a non-local SMTP server (or at least nobody mentions anything about it), or postfix and sendmail (which appears to be capable of such a thing - but couldn't figure out how). I have tried the default sendmail configuration - and the email bounced back complaining about possible spam when it reached the target email server. I assume then that I need to send through my provider's smtp server, not just straight to the internet.
My question is, how do I configure easily Sendmail to send emails through my provider's smtp server (using an email account I already have with my provider, so that is not a problem), or is there another way to do this more simply (from the command line) which I could integrate with Hylafax?
Slightly parallel with this - could a kind soul please explain to me briefly how this whole thing is working out? I mean, it looks like any good old mail program use to be able to send email to the internet directly, but since the spam and anti-spam business, you have to send through a provider's smtp server, not just directly routed to the internet - otherwise your email gets rejected by the receiver's server. Is my understanding correct?
Any pointers and thoughts on the issue are appreciated. I've spent the entire day reading up on this - and I ended up being more confused then when I started. I don't understand why isn't there the equivalent of a smtp client on the command line to just send emails (with no fancy relaying, authentication and routing capabilities) - something that will just format the message for you and pass it to an authenticated smtp server - and why people end up using full blown email servers like postfix or sendmail just to send away some emails?
P.S. I am most likely attacking the problem from the perspective of traditional gui email clients - which just talk to pop3 and smpt servers for their email functions (and hoping that such a thing can be replicated - or has been - on the command line)- so if I am missing the bigger picture here - feel free to put me in my place.
The main cause for rejection is that your reverse DNS probably isn't set up properly, and that in turn is because it's generally in your ISP's control. If your domain is example.com, but your IP reverse maps to your.isp.com, a lot of mail servers will reject you as spam.
Ask you ISP is they will set the reverse to your domain.
I don't use sendmail, but in postfix, just set the relay_host to point to the smtp server, and
isppasswd then contains
Thanks for your reply.
Just to make things clearer.
I have a domain name, which is hosted for the purposes of email by my email provider - who supplies pop3 mail boxes.
The machine I am configuring is not directly on the internet, but behind a NAT and not on a fixed IP address.
In these circumstances - I couldn't setup a reverse DNS pointing to this machine - would that be correct?
All I am after is a way/configuration to get email (with faxes attached) out of this machine (which has Hylafax on), through my email provider (or directly, but it doesn't look possible because of the anti-spam situation) to any email address out-there.
You may as well use the ISP's smtp server.
This link may help with setting up authentication http://www.linuxquestions.org/questi...-relay-354488/
(A search using www.google.com/linux using "sendmail smarthost authentication" gives plenty of hits).
Have you gotten hylafax sending faxes to local email OK? It's pretty easy to do if you haven't.
Thanks for that. I've had a quick look and it seems it is what I am after. Looks like the magic word is 'relay'. Shows how you can find a lot of stuff, once you know what to search for. I've been searching all day for sending email using sendmail.
You see these terms on sites like this one (smarthost I mean).
Let us know how you go.
Just thought I would let everybody know how it went. In the end I used Hylafax + Exim (for smtp server and as local command line interface for generating/sending emails) + Dovecot as POP3 server.
I also ended up routing the emails containing faxes exclusively internally - as this way I didn't have to depend on the external email provider and the internet connection being functional to receive faxes - so everything gets delivered through internal network. The email client software (Thunderbird) on the LAN connect directly through POP to the local Hylafax server machine and download the emails containing faxes as attachments.
I know I could have gotten away with a simpler setup (possibly using something like sSmtp to send directly to the email provider/isp's smtp server) - but I used it as an opportunity to delve into and learn about setting up Exim and Dovecot - and even setting up TLS/SSL encryption for SMTP and POP3 connections. It all works wonderfully in the end.
And I finally done what I dreaded and avoided for a long time - setting up an email server for the first time :-)
Any excuse to learn something new (and part with some sleep in the process).
Thanks to everybody for their contributions.
Thanks for the feedback. Glad you got it working.
|All times are GMT -5. The time now is 04:50 AM.|