3

This might be naive.

But is it possible in Ubuntu to have a script send out emails without requiring passwords? (via a dummy mail server, maybe)

I was hoping to use this to allow my account to periodically send info to myself (a real email account), for example, when certain task is completed. And I don't really want to risk storing the password for a real, external email account on the hard drive.

tinlyx
  • 3,230
  • Possibly. My ISP allows me to send mail with the only validation being my sending IP address. ie. I can telnet smtp.myisp.net 25 into their mail server & enter details for email then exit, which of course allowed me to script it & use it for myself. I've even had scripts send externally (not to isp email), but I've also had these rejected (I didn't explore; it was sent externally because of a typo). – guiverc Jan 18 '19 at 03:10

2 Answers2

0

Possibly, or at least it's worked for me...

My [home] ISP allows me to send mail with the only validation being my sending IP address (that I send the email from my home & not elsewhere).

I can

telnet smtp.myisp.net 25

into their mail server & enter commands needed to send email (as if I was a MUA) then exit, which of course allowed me to script it & use it for myself (alert me to jobs, events etc).

I've even had scripts send externally (not to my isp's email address), but I've also had these rejected (I didn't explore; it was sent externally because of a typo, not intentionally).

-- My use of telnet was NOT intended to be the end result; it was only to prove that it's possible. My script calls functions & does not shell out to telnet. Telnet was just to prove the idea worked before I wasted time scripting it, but YES this is a dirty hack.

guiverc
  • 30,396
  • I have to -1, this is a terrible thing to do. If you want to do this, you should properly configure your mail system to use smtp.myisp.net as a smarthost, not hack with telnet. – fkraiem Jan 18 '19 at 03:25
  • 1
    My use of telnet was NOT intended to be the end result; it was only to prove that it's possible. My script uses functions & does not shell out to telnet. Telnet was just to prove the idea worked before I scripted it. – guiverc Jan 18 '19 at 03:36
-1

Use MSMTP.

MSMTP is a program which delivers email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.

Upstream: https://marlam.de/msmtp/

Man Page in Ubuntu: http://manpages.ubuntu.com/manpages/bionic/man1/msmtp.1.html

  • This does not address the issue of password storage, since you have to store the password to your account on the mailhub. – fkraiem Jan 18 '19 at 03:30
  • All modern smtp, requires an authentication, unless you build an SMTP and that authentication is canceled (crazy) or that is open on your network.

    This option is the best, I think.

    – Carlos Dagorret Jan 18 '19 at 03:36