Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
2 answers
81 views
Email attachment created in bash script with uuencode and ssmtp is delivered with malformed filename and zero-length
This [very old thread][1] shows how to use uuencode and ssmtp to send an email with attachment from a bash script. I've created this test script to debug: #!/bin/bash set -x NOW=$( date '+%F' ) #( date '+%F_%H-%M-%S' ) LOGPATH=/home/pi/logs LOGFILE=test-log-$NOW.txt FULL_LOG=$LOGPATH'/'$LOGFILE echo...
This very old thread shows how to use uuencode and ssmtp to send an email with attachment from a bash script. I've created this test script to debug: #!/bin/bash set -x NOW=$( date '+%F' ) #( date '+%F_%H-%M-%S' ) LOGPATH=/home/pi/logs LOGFILE=test-log-$NOW.txt FULL_LOG=$LOGPATH'/'$LOGFILE echo "This is a test of the log email send $LOGPATH $LOGFILE $FULL_LOG " > $FULL_LOG echo -e "To: test@mydomain.com\nSubject: test log send\n\n" | (cat - && /usr/bin/uuencode $FULL_LOG) | /usr/sbin/ssmtp -t Output looks like this: + echo 'This is a test of the log email send /home/pi/logs test-log-2025-02-22.txt /home/pi/logs/test-log-2025-02-22.txt ' + echo -e 'To: test@mydomain.com\nSubject: test log send\n\n' + cat - + /usr/sbin/ssmtp -t + /usr/bin/uuencode /home/pi/logs/test-log-2025-02-22.txt No errors occur, and an email is delivered with the subject to the correct address. The problem is the email attachment is delivered as a file named homepilogstest-log-2025-02-222.txt The attachment is a zero-length file. The file is correctly created on the Pi and contains the expected contents: $ ls -l logs/test-log-2025-02-22.txt -rw-r--r-- 1 pi pi 116 Feb 22 12:19 logs/test-log-2025-02-22.txt $ cat logs/test-log-2025-02-22.txt This is a test of the log email send /home/pi/logs test-log-2025-02-22.txt /home/pi/logs/test-log-2025-02-22.txt What am I missing?
tim11g (115 rep)
Feb 22, 2025, 06:33 PM • Last activity: Feb 25, 2025, 01:40 PM
4 votes
2 answers
5384 views
Can I make SSMTP to automatically set the "To:" header?
I'm using the ssmtp package to send e-mail via g-mail. Everything is working fine with it - the only strange thing is that if I send mail via the command line, the "to field" is funky. ssmtp me@domain.com < message.txt Basically the "to" field will just say "undisclosed recipients" I read that you c...
I'm using the ssmtp package to send e-mail via g-mail. Everything is working fine with it - the only strange thing is that if I send mail via the command line, the "to field" is funky. ssmtp me@domain.com < message.txt Basically the "to" field will just say "undisclosed recipients" I read that you can set headers containing a "To:" field, but that seems overly complicated when I've used the mail command on other systems, I it will do this automatically. Is there an easier way to send mail via the command line with ssmtp - but without having to change the above syntax or specify additional parameters? (possibly a config file to set the "to" address as whatever one was specified.
cwd (46887 rep)
Jun 29, 2012, 06:42 PM • Last activity: Dec 6, 2024, 03:46 AM
10 votes
6 answers
18872 views
Troubleshooting sSMTP: Authorization failed
My requirements are: * send an email from the terminal (for the sake of batch processing) * attach a pdf file to that email (the pdfs would be identical for all recipients, except for a watermark) * specify a reply-to address (myusername@gmail.com) I've tried the ["simplest answer to sending one-lin...
My requirements are: * send an email from the terminal (for the sake of batch processing) * attach a pdf file to that email (the pdfs would be identical for all recipients, except for a watermark) * specify a reply-to address (myusername@gmail.com) I've tried the "simplest answer to sending one-line messages via gmail is to use ssmtp" , and several variants, and keep getting: > laptop sSMTP: Authorization failed (535 5.7.8 > https://support.google.com/mail/?p=BadCredentials d13sm3920147qkj.27 - > gsmtp) Google settings: * IMAP enabled * Allow less secure apps is ON For each ssmtp.conf setup that I tried, I have done DisplayUnlockCaptcha just before: $echo "Testing...1...2...3" | ssmtp myusername@gmail.com Looking at the stated thread alone, there is no consensus as to how /etc/ssmtp/ssmtp.conf should be set up: * mailhub=smtp.gmail.com:587 vs 465 * UseTLS=YES vs UseSTARTTLS=Yes (or both?) * hostname=localhost vs whatever was put there as the default (in my case, laptop) Could someone make a suggestion to sort this out, and possibly paste in full a working conf file? There is a claim in a thread from 2017 , that: > You can not use external applications with your normal password, you > must go to https://security.google.com/settings/security/apppasswords Is that the case? (I'm not able to do it) What alternatives are there? PS: * OS: Linux Mint 19 Tara * ssmtp was tested from a clean install preceded by upgrade/update * a couple of years ago, I was a able to send emails using the same OS (earlier version) * To make sure the value of AuthPass is correct, I used it to manually log into my google account.
Erwann (729 rep)
Jun 27, 2020, 06:49 PM • Last activity: Nov 27, 2024, 05:46 AM
2 votes
1 answers
9131 views
mail: Can't send message: process exited with a non-zero status
Any idea why it is not sending mail for me? Am I missing something? I tried a few articles and it seems like I have done everything correctly; so I am a bit stuck on this? sudo apt-get update sudo apt-get install ssmtp And in /etc/ssmtp/ssmtp.conf I have: root=hidennBecausePrivate@gmail.com mailhub=...
Any idea why it is not sending mail for me? Am I missing something? I tried a few articles and it seems like I have done everything correctly; so I am a bit stuck on this? sudo apt-get update sudo apt-get install ssmtp And in /etc/ssmtp/ssmtp.conf I have: root=hidennBecausePrivate@gmail.com mailhub=smtp.gmail.com:587 FromLineOverride=YES AuthUser=hidennBecausePrivate@gmail.com AuthPass=password UseTLS=YES I get this message when I enter this command: echo "Hello world email body" | mail -s "Test Subject" hostname@gmail.com mail: cannot send message: Process exited with a non-zero status
Sammy (39 rep)
Jul 22, 2019, 04:48 AM • Last activity: Jul 26, 2024, 05:07 PM
3 votes
2 answers
10102 views
SSMTP: How to send email with both a body and attachment
I am currently using the following command to send emails from my Ubuntu server, which I adapted from this question's answer: https://unix.stackexchange.com/a/90881/166614 printf "subject: the subject\n\nMessage body"| (cat - && uuencode "$attach" $(basename "$attach")) | ssmtp My only problem so fa...
I am currently using the following command to send emails from my Ubuntu server, which I adapted from this question's answer: https://unix.stackexchange.com/a/90881/166614 printf "subject: the subject\n\nMessage body"| (cat - && uuencode "$attach" $(basename "$attach")) | ssmtp My only problem so far is that the command above creates two attachments consisting of the file indicated by the $attach variable and a text file containing what's supposed to be the message body with a seemingly random number for a name. If I remove the (cat - && uuencode "$attach" $(basename "$attach")) command, the email has a body as it should but (obviously) no attachment. Conversely, if I remove the body, the text file attchment is not present. Does anyone know how I can send an email through SSMTP with both a body and attachment?
XJDHDR (201 rep)
Sep 10, 2016, 02:17 PM • Last activity: Jul 5, 2024, 04:49 PM
12 votes
3 answers
66382 views
ssmtp: Cannot open mail:25
I've installed ssmtp and then edited the ssmtp.conf file so could try sending a mail but says cannot open mail:25 however in the conf file I set it to gmail port 467 and I am pretty sure everything else is right. What specifically do I need to look for with this error or could it be any number of se...
I've installed ssmtp and then edited the ssmtp.conf file so could try sending a mail but says cannot open mail:25 however in the conf file I set it to gmail port 467 and I am pretty sure everything else is right. What specifically do I need to look for with this error or could it be any number of settings in and outside of the configuration file? # # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # See the ssmtp.conf(5) man page for a more verbose explanation of the # available options. # # The person who gets all mail for userids < 500 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and your mailhub is so named. mailhub=mail # Example for SMTP port number 2525 mailhub=smtp.gmail.com:465 # Example for SMTP port number 25 (Standard/RFC) # mailhub=mail.your.domain # Example for SSL encrypted connection # mailhub=mail.your.domain:465 # Where will the mail seem to come from? #RewriteDomain= # The full hostname #Hostname= # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. #FromLineOverride=YES # Use SSL/TLS to send secure messages to server. UseTLS=YES UseSTARTTLS=YES AuthUser=user@gmail.com AuthPass=xxxxxx # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES # Use this RSA certificate. #TLSCert=/etc/pki/tls/private/ssmtp.pem TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt # Get enhanced (*really* enhanced) debugging information in the logs # If you want to have debugging of the config file parsing, move this option # to the top of the config file and uncomment #Debug=YES Interestingly all the files in /etc/pki/tls/certs/ are the exact same ones I deleted in my /etc/ssl folder! haha Now I know a certain amount of business happened when creating an untrusted cert.
cea (1573 rep)
Jun 7, 2014, 02:16 PM • Last activity: Apr 7, 2024, 12:43 PM
51 votes
8 answers
94954 views
Simplest way to send one-line mail out via command line using gmail?
Using Raspbian and Ubunntu 16.04 LTS so need a generic Linux solution. Requirement is simple: **I need a way to send one-line email messages from the command line.** I have set up a gmail account just for this particular Rpi3, with the address of rpi3abc@gmail.com - with no 2FA So now I need to be a...
Using Raspbian and Ubunntu 16.04 LTS so need a generic Linux solution. Requirement is simple: **I need a way to send one-line email messages from the command line.** I have set up a gmail account just for this particular Rpi3, with the address of rpi3abc@gmail.com - with no 2FA So now I need to be able to send one-line mail messages from anywhere (including cron) without user intervention. ----------------------- I also would like it to be able to send text files; basically, anything from stdin.
SDsolar (1899 rep)
May 9, 2017, 02:19 AM • Last activity: Jan 30, 2024, 01:22 PM
0 votes
1 answers
105 views
Are e-mails to localhost logged with sSMTP?
I don't suppose that sSMTP will work for just sending mail on the localhost? nicholas@mordor:~$ nicholas@mordor:~$ sudo cat /etc/ssmtp/ssmtp.conf # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place...
I don't suppose that sSMTP will work for just sending mail on the localhost? nicholas@mordor:~$ nicholas@mordor:~$ sudo cat /etc/ssmtp/ssmtp.conf # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=mail # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=mordor.saundersconsulting.tech # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address #FromLineOverride=YES nicholas@mordor:~$ nicholas@mordor:~$ sudo cat /etc/ssmtp/revaliases # sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:your_login@your.domain:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. nicholas@mordor:~$ nicholas@mordor:~$ swaks --to root@mordor.saundersconsulting.tech --from nicholas@mordor.saundersconsulting.tech --server mordor.saundersconsulting.tech === Trying mordor.saundersconsulting.tech:25... *** Error connecting to mordor.saundersconsulting.tech:25: *** IO::Socket::INET6: connect: Connection refused nicholas@mordor:~$ nicholas@mordor:~$ hostname mordor.saundersconsulting.tech nicholas@mordor:~$ nicholas@mordor:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 23.10 Release: 23.10 Codename: mantic nicholas@mordor:~$ There's no mention of anything except for gmail in mail.log and mail.err which were attempted previously. To my understanding sSMTP only will relay e-mail. notable result: nicholas@mordor:~$ nicholas@mordor:~$ ssmtp nicholas@mordor.saundersconsulting.tech subject:ping ssmtp: Cannot open mail:25 nicholas@mordor:~$ that sSMTP cannot open port 25?
Nicholas Saunders (565 rep)
Dec 19, 2023, 01:33 PM • Last activity: Dec 19, 2023, 02:10 PM
5 votes
2 answers
1599 views
Light program (mini MTA?) for system mail (only sending/relay via external server with unattended-upgrades, cron, smartmontools, etc.)
I've come across different names in different places: Light MTA, Remote MTA, Smarthost, etc. Generally, I do not want to install a full-fledged mail server (such as `sendmail`, `postfix`, `exim`), but only send notifications/emails using an existing external ISP/mail provider (such as dismail.de, ma...
I've come across different names in different places: Light MTA, Remote MTA, Smarthost, etc. Generally, I do not want to install a full-fledged mail server (such as sendmail, postfix, exim), but only send notifications/emails using an existing external ISP/mail provider (such as dismail.de, mailfence.com or others) with unattended-upgrades, cron, smartmontools, my own bash scripts etc from all over the system. Additionally, it would be ideal if there was support for queuing and retrying (an attempt to resend in the event of being offline or temporarily unreachable by the mail provider) So far I've found: - ssmtp - msmtp - s-nail - nullmailer - dma - esmtp But I didn't find any comparison between them. 1. Does anyone know what makes the program stand out from the rest? (positives, negatives, ease of configuration, low resource consumption, etc.) 2. Possibly I missed something and maybe there is another one, better than all those mentioned for Debian? 3. Did I understand correctly that s-nail is also an MUA and bsd-mailx or mailutils is not needed? Maybe others too?
DarekH (157 rep)
Sep 18, 2023, 03:47 PM • Last activity: Sep 21, 2023, 04:18 PM
0 votes
0 answers
245 views
ssmtp vs. Gmail
I am trying to setup my raspberry's ssmtp to use my Gmail account. I followed recommendations I found around, everything looks ok but the mail does not come. ssmtp.conf: ``` root= @gmail.com mailhub=smtp.gmail.com:587 hostname= .ydns.eu FromLineOverride=YES AuthUser= @gmail.com AuthPass=16charpassfr...
I am trying to setup my raspberry's ssmtp to use my Gmail account. I followed recommendations I found around, everything looks ok but the mail does not come. ssmtp.conf:
root=@gmail.com
mailhub=smtp.gmail.com:587
hostname=.ydns.eu
FromLineOverride=YES
AuthUser=@gmail.com
AuthPass=16charpassfromGoogle
UseSTARTTLS=Yes
UseTLS=YES
revaliases:
root:@gmail.com:smtp.gmail.com:587
pi:@gmail.com:smtp.gmail.com:587
actual command:
pi@raspberrypi:~ $ echo -e  "to: @gmail.com\nsubject: [RASPBERRY]\n\nTest 1...2...3" |  ssmtp -vvv @gmail.com
[] EHLO .ydns.eu
[] STARTTLS
[] EHLO .ydns.eu

close(4)                                = 0
getuid32()                              = 1000
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
_llseek(4, 0, , SEEK_CUR)            = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=2307, ...}) = 0
read(4, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2307
close(4)                                = 0
ioctl(0, TCGETS, 0xbef3b238)            = -1 ENOTTY (Inappropriate ioctl for device)
openat(AT_FDCWD, "/home/pi/dead.letter", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
_llseek(4, 0, , SEEK_END)          = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=657, ...}) = 0
write(4, "\n\n", 2)                     = 2
close(4)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
What is it trying to do with /etc/passwd and what should I get from "Inappropriate ioctl for device" message? What do I miss?
user1608790 (101 rep)
Jun 20, 2023, 05:01 PM • Last activity: Jun 21, 2023, 08:49 AM
10 votes
3 answers
20147 views
install ssmtp in Debian buster
I try to install `ssmtp` in Debian 10.0, but get the error Package ssmtp is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source But I get no result with neither ` apt search ssmpt` nor: $ apt-fi...
I try to install ssmtp in Debian 10.0, but get the error Package ssmtp is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source But I get no result with neither apt search ssmpt nor: $ apt-file search ssmtp monitoring-plugins-basic: /usr/lib/nagios/plugins/check_ssmtp sosreport: /usr/share/sosreport/sos/plugins/ssmtp.py How do I install ssmtp in Debian buster?
rubo77 (30435 rep)
Jun 16, 2019, 08:46 AM • Last activity: Apr 15, 2023, 12:22 PM
33 votes
9 answers
133056 views
mail: cannot send message: process exited with a non-zero status
I've had a cronjob working for about a fortnight without any problems. Then last night I checked I didn't get the email that I usually get. I went to the terminal to try send myself an email, I got the following error: *mail: cannot send message: process exited with a non-zero status* I haven't chan...
I've had a cronjob working for about a fortnight without any problems. Then last night I checked I didn't get the email that I usually get. I went to the terminal to try send myself an email, I got the following error: *mail: cannot send message: process exited with a non-zero status* I haven't changed anything with my ssmtp cfg file. It just stopped working, when I check and recheck everything, the code, ssmtp, everything is perfect. I send out my emails twice a day via cronjob. The crontab hasn't been interfered either. I really don't know why it would stop working. The system sends out emails via gmail - I've gone into the gmail account and sent out test emails, they are sent and received without any problems. Additionally I've checked throughout google, forums, websites I don't see any mistakes. This makes sense as everything was working fine 24 hours ago, and now it's just stopped. **Q:** Is there any way of diagnosing and troubleshooting how to solve such a problem?
3kstc (4996 rep)
Feb 17, 2015, 10:08 PM • Last activity: Mar 25, 2023, 12:58 AM
4 votes
1 answers
185 views
Where are these "extra" RCPT_TO lines coming from when I send an email via SSMTP?
I've been using SSTMP on a local FreeBSD machine to send stuff like the output of certain cron jobs to my "real" main email account, which is not hosted on the same machine (or even domain). For example, I have a daily cron job set up as so: ``` smartctl -a /dev/ada0 | grep overall-health | mail -s...
I've been using SSTMP on a local FreeBSD machine to send stuff like the output of certain cron jobs to my "real" main email account, which is not hosted on the same machine (or even domain). For example, I have a daily cron job set up as so:
smartctl -a /dev/ada0 | grep overall-health | mail -s "Silicon daily smartctl" bob@vesterman.com
This works fine, insofar as the mail being successfully delivered to my "real" email account. However, every time I send a message, I also receive a bunch of warning and bounce messages from my "real" email account's mail system. I found that `mail has a "verbose" flag, -v`, which shows the conversation between my SSMTP and the host of my "real" email account. I tried it out, and noticed the following interesting portion:
[->] RCPT TO:
[] RCPT TO:
[] RCPT TO:
[] RCPT TO:
[] RCPT TO:
[<-] 250 Accepted
So SSMTP is saying that the message should be sent not only to the intended recipient, but also to three other addresses? And one of them is especially weird looking ("/usr/local/sbin/ssmtp@vesterman.com"), and for some reason that one gets *two* RCPT TO lines. I have no idea where these "extra" RCPT TO lines are coming from. Anyone have any idea? Thanks. Contents of my /usr/local/etc/ssmtp/ssmtp.conf:
root=bob@vesterman.com
mailhub=mail.vesterman.com:465
rewriteDomain=vesterman.com
hostname=silicon.vestertopia.net
FromLineOverride=YES
UseTLS=YES
AuthUser=robotsender@vesterman.com
AuthPass=hunter2
Bob Vesterman (277 rep)
Feb 1, 2023, 11:36 PM • Last activity: Feb 2, 2023, 04:19 AM
1 votes
1 answers
1461 views
Which domain is HELO checked against with rDNS? Mail server's domain, even if different from the sender's domain? Or the email sender's domain?
I run a small webserver that hosts a handful of domains which I use for personal and testing purposes. I want to set it up as a mail server as well, and I'm trying to understand the rDNS lookup that checks against the SMTP HELO header. The problem is that I have no control over the PTR records for m...
I run a small webserver that hosts a handful of domains which I use for personal and testing purposes. I want to set it up as a mail server as well, and I'm trying to understand the rDNS lookup that checks against the SMTP HELO header. The problem is that I have no control over the PTR records for my server's IP address, and there's no chance the ISP would delegate that to me. Let's say my IP address is 123.45.67.89. Then the PTR record for my IP resolves to a hostname like
-045-067-089.customers.my-isp.net
. **TL;DR -- I'm trying to understand what rDNS domain is being looked for in the SMTP HELO header? Is it the domain name of the email's sender (e.g.
@mydomain.com
) or the hostname of the mail exchange server even IF the server has a completely different domain name than the sender?** **If I were to use the ISP's hostname of my IP address (e.g.
-045-067-089.customers.my-isp.net
) as the HELO header\*\* for emails sent from
.com
, would that validate emails from
@mydomain.com
sent by my mail server at IP address 123.45.67.89, or does the PTR record for 123.45.67.89 need to resolve to
.com
?** \*\*I could also obtain a TLS cert for
-045-067-089.customers.my-isp.net
, and have the MX record and TXT-spf record for
.com
point to
-045-067-089.customers.my-isp.net
Long version: Here's my very novice understanding of how the SMTP HELO check against rDNS works. Let's say my domain was
.com
, and I wanted to send an email from
@mydomain.com
to
@gmail.com
. I'd first connect my desktop client to my mail server. The mail server (at IP address 123.45.67.89) would then connect to the mail server at
.com
. In this scenario, let's say the HELO header listed
.com
as its domain name. So the gmail server would then do rDNS lookup on my server's IP address, only to discover that 123.45.67.89 resolves to hostname
-045-067-089.customers.my-isp.net
. Because this does not match the domain provided in the HELO header, the gmail server assumes this is spam and rejects it. So far so good? Or no? Now, let's suppose instead of putting
.com
as the SMTP HELO header, my mail server instead puts
-045-067-089.customers.my-isp.net
, and furthermore has a TLS certificate for that domain signed by an established CA. Also, the MX and TXT-spf records for
.com
point to
-045-067-089.customers.my-isp.net
as the established mail server. (Note: It's not clear to me whether the SMTP HELO also dictates the domain of the sender's email???) In this second scenario, would the email being sent from
@mydomain.com
to
@gmail.com
be validated by the gmail server and recognized as a legitimate email? Or would it still fail because
-045-067-089.customers.my-isp.net
provided in HELO does not match the email sender's
.com
. (again... it's not clear to me whether this is even possible with the SMTP protocol... I'm very new to email servers) Of course (this should go without saying...) I DO have full control over all of the DNS forward zone records for the domains I own. Also, I do have a stable long-term IP address, and all of my domains (and sub-domains) are configured to resolve back to my established IP address.
billyjoepiano (13 rep)
Dec 8, 2022, 05:35 PM • Last activity: Dec 8, 2022, 06:26 PM
0 votes
1 answers
2033 views
crontab error - SSMTP - 553 5.7.1 Sender address rejected: not owned by user
As root, I installed ssmtp and I configured the `/etc/ssmtp/ssmtp.conf` as follows: ``` # Sender email address root=myemail@domain.com # Destination SMTP server and port mailhub=mail.domain.com:587 # Username and password AuthUser=myemail@domain.com AuthPass=password # Sender domain rewriteDomain=do...
As root, I installed ssmtp and I configured the /etc/ssmtp/ssmtp.conf as follows:
# Sender email address
root=myemail@domain.com

# Destination SMTP server and port
mailhub=mail.domain.com:587

# Username and password
AuthUser=myemail@domain.com
AuthPass=password

# Sender domain
rewriteDomain=domain.com

# Machine's hostname
hostname=mail.domain.com:587

# Allow set From name in each email
FromLineOverride=YES

UseSTARTTLS=YES
UseTLS=YES
I also configured revaliases in /etc/ssmtp/revaliases adding the following row: root:myemail@domain.com:mail.domain.com:587 I set a cron running crontab -e and added the rows (just to test it's running):
MAILTO=myemail@domain.com
* * * * * echo "this is a test"
If I run grep cron /var/log/syslog I see the following error:
cron: sendmail: RCPT TO: (553 5.7.1 : Sender address rejected: not owned by user myemail@domain.com)
myemail@domain.com is changed in root@domain.comand I cannot find a solution. Any help?
nicfab (3 rep)
Oct 2, 2022, 03:17 PM • Last activity: Oct 2, 2022, 08:07 PM
0 votes
1 answers
3377 views
How to Install sSMTP on CentOS 8 AppStream
I have used the [sSMTP][1] package on CentOS 7 to send root emails to my Gmail address using an external mail server. However, the package isn't officially available for CentOS 8 in the EPEL 8 repo. Can it be installed on this OS like installing from the source? I assume that the source code is [ava...
I have used the sSMTP package on CentOS 7 to send root emails to my Gmail address using an external mail server. However, the package isn't officially available for CentOS 8 in the EPEL 8 repo. Can it be installed on this OS like installing from the source? I assume that the source code is available on GitHub . I'm a novice about Linux so if it is possible then clear step-by-step instructions would be most helpful. Thank you
Rajan Sharma (23 rep)
Aug 18, 2022, 05:49 PM • Last activity: Aug 19, 2022, 05:44 AM
0 votes
2 answers
3606 views
Auth error when sending mail through Postfix with SSMTP
I'm trying to send mail from server A running SSMTP via a server B running Postfix. The Postfix server is running just fine and has been in production for a while without any problems. It runs Postfix with Dovecot. I can use my Gmail account to send mail from SSMTP and that works however I want to u...
I'm trying to send mail from server A running SSMTP via a server B running Postfix. The Postfix server is running just fine and has been in production for a while without any problems. It runs Postfix with Dovecot. I can use my Gmail account to send mail from SSMTP and that works however I want to use my own Postfix server because I want more control over the entire mail process. **In the next logs and code I have replaced my own public domain with example.com.** Here is the error that SSMTP produces: root@N40L:/etc/ssmtp# echo "test" | mailx -vvv -s "test" martin@example.com [] EHLO example.com [] AUTH LOGIN [, method=PLAIN, rip=::1, lip=::1, mpid=14050, secured, session= Jan 16 10:46:12 dovecot: imap: Debug: Loading modules from directory: /usr/lib/dovecot/modules Jan 16 10:46:12 dovecot: imap: Debug: Module loaded: /usr/lib/dovecot/modules/lib10_quota_plugin.so Jan 16 10:46:12 dovecot: imap: Debug: Module loaded: /usr/lib/dovecot/modules/lib11_imap_quota_plugin.so Jan 16 10:46:12 dovecot: imap: Debug: Added userdb setting: plugin/email=n40l@example.com Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Effective uid=5000, gid=5000, home=/var/mail/vmail/example.com/n40l Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Quota root: name=User quota backend=maildir args= Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Quota rule: root=User quota mailbox=* bytes=10737418240 messages=0 Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Quota rule: root=User quota mailbox=Trash bytes=+104857600 messages=0 Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Quota grace: root=User quota bytes=536870912 (5%) Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/var/mail/vmail/example.com/n40l Jan 16 10:46:12 dovecot: imap(n40l@example.com): Debug: maildir++: root=/var/mail/vmail/example.com/n40l, index=, indexpvt=, control=, inbox=/var/mail/vmail/example.com/n40l, alt= Jan 16 10:46:12 dovecot: imap(n40l@example.com): Disconnected: Logged out in=50 out=475 I can log into server B's webmail without any trouble and send and receive mail for the address I'm using so the account itself is in order. I tried other accounts and they produce the same errors. I'm at a loss. SSMTP should be able to send mail through Postfix. Even with all debug and verbosity options on, I can't find the source of the problem. Any help is greatly appreciated.
Forkbeard (657 rep)
Jan 16, 2017, 10:09 AM • Last activity: Aug 1, 2022, 06:03 AM
0 votes
2 answers
2919 views
ssmtp in docker image
I'm trying to setup ssmtp (for sendmail) in Docker image. To do so I've created the folowing Dockerfile: ``` FROM php:7.4-apache # Install paquet requirements RUN set -ex; \ # Install required system packages apt-get update; \ apt-get install -qy --no-install-recommends \ ssmtp \ mailutils \ ; \ # C...
I'm trying to setup ssmtp (for sendmail) in Docker image. To do so I've created the folowing Dockerfile:
FROM php:7.4-apache

# Install paquet requirements
RUN set -ex; \
    # Install required system packages
    apt-get update; \
    apt-get install -qy --no-install-recommends \
            ssmtp \
            mailutils \
    ; \
    # Clean aptitude cache and tmp directory
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*;
As you can see I have installed ssmtp and mailutils. My /etc/ssmtp.conf file contains all credentials that I can log into my account using standard mail client:
root=serwer@mydomain.com

mailhub=mail.mydomain.com:587
AuthUser=serwer@mydomain.com
AuthPass=PASS_HERE

FromLineOverride=YES

UseTLS=YES
#UseSTARTTLS=YES
Debug=YES

hostname=OVERRIDEN_HOSTNAME
From some reason mail is not sent. I'm tying with sendmail command:
sendmail my_email@example.com
Subject: aaa
aaa
CTRL+d
and getting error:
sendmail: Authorization failed (535 Incorrect authentication data)
Even Debug=YES is set, I do not see any log under /var/log regarding sendmail. However, when I am trying to use ssmtp command in verbose mode, the folowing logs are produced:
root@c7e406d765c1:/app# ssmtp -d9 my_email@example.com
[] EHLO ****.com
[] AUTH LOGIN
[] c2Vyd2VyDQ==
[<-] 334 UGFz[*** tuncated here ***]
[<-] 535 Incorrect authentication data
ssmtp: Authorization failed (535 Incorrect authentication data)
This is quite strange because same credentials (from config) works for instance in PHPMailer configuration. Do you have any thought what might be wrong? Thank you all!
Athlan (141 rep)
Apr 19, 2022, 05:27 AM • Last activity: Apr 20, 2022, 05:46 PM
3 votes
2 answers
24887 views
Problem sending email using ssmtp
I am attempting to setup so I can mail from Raspbian. When I attempt to send I get an error `ssmtp: Cannot open smtp.gmail.com:587` (I also tried port:465) I have set "Access for less secure apps" on Google and can send/receive from the account on Thunderbird. I have installed `ssmtp` and configured...
I am attempting to setup so I can mail from Raspbian. When I attempt to send I get an error ssmtp: Cannot open smtp.gmail.com:587 (I also tried port:465) I have set "Access for less secure apps" on Google and can send/receive from the account on Thunderbird. I have installed ssmtp and configured /etc/ssmtp/ssmtp.conf to contain:- # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=xxxxxx.raspberry.pi@gmail.com # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 AuthUser=xxxxxx.raspberry.pi@gmail.com AuthPass=xxxxxxxxxxxxxx UseTLS=YES UseSTARTTLS=YES # Where will the mail seem to come from? rewriteDomain=gmail.com # The full hostname hostname=xxxxxx.raspberry.pi@gmail.com # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address FromLineOverride=YES I have also configured /etc/ssmtp/revaliases to contain:- # sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:your_login@your.domain:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. root:xxxxxx.raspberry.pi@gmail.com:smtp.gmail.com:587 Any suggestions? ---------- Edit The settings above based on https://wiki.archlinux.org/index.php/SSMTP I have done some further testing. 1. I selected a different SMTP server, which worked. (I do not want to use this, as it is only available when directly connected to my ISP.) 2. I tried setting an Application Specific password, and got the response"The setting you are looking for is not available for your account". (Presumably because this account does not have 2-factor authentication.) The gmail account I am trying to use was specifically created to send messages from the Raspberry Pi.
Milliways (1408 rep)
Apr 19, 2017, 07:41 AM • Last activity: Feb 11, 2022, 04:04 AM
1 votes
1 answers
266 views
After upgrade my cron script does not find the command /usr/sbin/ssmtp
I have several raspberries running the same cron script but after updating/upgrading jessie on one of them i get ssmtp:: command not found I can run that command from the command-line but running the script from the command-line fails so not really a cron problem. I am using full path: `/usr/sbin/ss...
I have several raspberries running the same cron script but after updating/upgrading jessie on one of them i get ssmtp:: command not found I can run that command from the command-line but running the script from the command-line fails so not really a cron problem. I am using full path: /usr/sbin/ssmtp And using that command on the command line executes fine echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games And here is snip of the script code #!/bin/bash set -o pipefail mysendmail="/usr/sbin/ssmtp" … $(echo -e "To: $tophil\nSubject: $(hostname) $ip2" | $mysendmail $tophil 2>&1)
phil (13 rep)
Sep 24, 2021, 09:45 AM • Last activity: Sep 25, 2021, 10:33 PM
Showing page 1 of 20 total questions