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
1 answers
2323 views
Run a command and email the output, with a subject, using msmtp
I have OpenWRT router, installed `msmtp`. I would like to write a command line (or a .sh file) that would send me the current public IP address, and let `cron` execute it every 15 Min. I found the posting: https://unix.stackexchange.com/questions/537082/run-a-command-and-email-the-output and tried t...
I have OpenWRT router, installed msmtp. I would like to write a command line (or a .sh file) that would send me the current public IP address, and let cron execute it every 15 Min. I found the posting: https://unix.stackexchange.com/questions/537082/run-a-command-and-email-the-output and tried to do the same with msmtp, and it did work: I did the following kdig +short myip.opendns.com @resolver1.opendns.com | msmtp xxxxxxxx@gmail.com and got an email with the current public IP address, but without a subject, of course, because I didn't set anything. Now, for msmtp, the way to put a subject is echo "Subject: Current Public IP" | msmtp xxxxxxx@gmail.com But I have no idea how I could combine these two things.... I would appreciate your help very much !
jbweld (1 rep)
Aug 17, 2021, 08:14 PM • Last activity: Jun 11, 2025, 10:04 AM
1 votes
1 answers
68 views
Unable to send automated mail using udev and msmtp
I am trying to write a script to send an email whenever a usb device is connected to my computer (Arch Linux). The code I wrote is ``` #!/bin/bash if [[ ! -z "$1" ]]; then echo "USB inserted at $(date) for $1 and $2" >> /home/user/commands/logs.log cd ~ ip -4 addr | grep -oP '(? /home/user/commands/...
I am trying to write a script to send an email whenever a usb device is connected to my computer (Arch Linux). The code I wrote is
#!/bin/bash
if [[ ! -z "$1" ]]; then
	echo "USB inserted at $(date) for $1 and $2" >> /home/user/commands/logs.log
	cd ~
	ip -4 addr | grep -oP '(? /home/user/commands/testing.txt
	echo -e "Subject: Hello \n\nBody:usb inserted at $(ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}')\nthrough the mail" | msmtp mymail@gmail.com
fi
the script is supposed to send the ipv4 address to the mail. The usb insertion is being detected and the log file and testing txt file is being written. But the mail is not being sent. I wrote the mail code separately through the terminal and it seems to be working. But inside the code, the mail is not getting run. I have set the msmtp working. I have checked using terminal commands directly and it is working. But through the script it is not working. All other commands are getting executed and I am getting the files. This is my rules script
ACTION=="add",\
SUBSYSTEMS=="usb",\
ENV{DEVTYPE}=="usb_device",\
RUN+="/usr/local/bin/usbinserted.sh '%E{DEVTYPE}' '%E{DEVNAME}'"
JustaNobody (31 rep)
Jan 26, 2024, 11:55 AM • Last activity: Apr 7, 2025, 12:49 PM
0 votes
0 answers
73 views
Issues with Neomutt SMTP configuration
I have the following things not working in my neomutt application: 1. Email is displayed instead of Username. For example : `johndoe@example.com ` is displayed instead of `John Doe `. 2. How to ensure that Neomutt applies the `Standard TLS encryption for security` similar to Gmail, which encrypts em...
I have the following things not working in my neomutt application: 1. Email is displayed instead of Username. For example : johndoe@example.com is displayed instead of John Doe . 2. How to ensure that Neomutt applies the Standard TLS encryption for security similar to Gmail, which encrypts emails on transit? Neomutt MSMTP config
account johndoe@example.com
host smtp.gmail.com
port 587
from johndoe@example.com
user "John Doe"
auth xoauth2
passwordeval ""
tls_starttls
tls on
tls_trust_file	/etc/ssl/certs/ca-certificates.crt
logfile /home/greninja/.config/msmtp/msmtp.log
GreninjaShuriken4 (1 rep)
Feb 6, 2025, 06:42 AM
0 votes
1 answers
429 views
msmtp having issues authenticating
Ive been trying to follow [this guide][1] to setup msmtp but its still not working. I have the msmtprc file in both /etc/msmtprc and ~/.msmtprc with the exact same contents # Set default values for all following accounts. defaults auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logf...
Ive been trying to follow this guide to setup msmtp but its still not working. I have the msmtprc file in both /etc/msmtprc and ~/.msmtprc with the exact same contents # Set default values for all following accounts. defaults auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log # Gmail account gmail host smtp.gmail.com port 465 tls_starttls off from og@gmail.com user og@gmail.com password # Set a default account account default: gmail Ive installed msmtp-mta and s-nail however **/etc/mail.rc does NOT exist** my alias file contains a single entry > admin@momspi:~ $ cat /etc/aliases > # See man 5 aliases for format > postmaster: og@gmail.com but when i go to test it, it fails
admin@momspi:~ $ echo "hello there username." | msmtp -a default og@gmail.com
msmtp: authentication failed (method PLAIN)
msmtp: server message: 535-5.7.8 Username and Password not accepted. For more information, go to
msmtp: server message: 535 5.7.8  https://support.google.com/mail/?p=BadCredentials  s9-20020a170902c64900b001ec6bab93cdsm428323pls.15 - gsmtp
msmtp: could not send mail (account default from /home/admin/.msmtprc)
owen gerig (113 rep)
Apr 30, 2024, 02:04 PM • Last activity: Jul 7, 2024, 12:42 AM
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
6 votes
4 answers
10557 views
Msmtp does not understand `/etc/aliases`
I have configured my Debian server to use `msmtp` for sending mails. Current use case are for example sending a daily report from `logwatch` to my isp email. `echo "$body" | mutt -s "$topic" -- "myisp@email.com"` I have configured `msmtp` by means of a global `msmtprc` file located at `/etc/msmtprc`...
I have configured my Debian server to use msmtp for sending mails. Current use case are for example sending a daily report from logwatch to my isp email. echo "$body" | mutt -s "$topic" -- "myisp@email.com" I have configured msmtp by means of a global msmtprc file located at /etc/msmtprc. Contents shown below. The next thing I want to configure is that my email for my root account (e.g., output from crontabs) is sent to my isp email as well. I have googled around and found, for example on the Arch wiki, that I should just configure my aliases. Which I have done so at the bottom of the msmtp configuration file. However, after running newaliases, and trying to execute echo test | mail -s "test message" root I get the error send-mail: /etc/aliases: line 2: invalid address 'postmaster' Can't send mail: sendmail process failed with error code 78 I am unsure how I can fix this. The alias shown below is what was already present. I only added the gmail address. I think I could just put a new aliases file but that might break other services that rely on this. I.e., I don't know what the proper way to fix this is. # /etc/aliases # /etc/aliases mailer-daemon: postmaster postmaster: root nobody: root hostmaster: root usenet: root news: root webmaster: root www: root ftp: root abuse: root noc: root security: root root: christphe, christophe.detroyer@gmail.com # /etc/msmtprc # ------------------------------------------------------------------------------ # msmtp System Wide Configuration file # ------------------------------------------------------------------------------ # A system wide configuration is optional. # If it exists, it usually defines a default account. # This allows msmtp to be used like /usr/sbin/sendmail. # ------------------------------------------------------------------------------ # Accounts # ------------------------------------------------------------------------------ account isp host mail.isp.net port 587 from admin@isp.com auth login user admin@isp.com password foobar syslog LOG_MAIL logfile /var/log/msmtp.log # ------------------------------------------------------------------------------ # Configurations # ------------------------------------------------------------------------------ # Construct envelope-from addresses of the form "user@oursite.example". #auto_from on #maildomain fermmy.server # Use TLS. tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. # Must be done within "account" sub-section above #syslog LOG_MAIL # Set a default account account default : isp aliases /etc/aliases # ------------------------------------------------------------------------------#
Christophe De Troyer (246 rep)
Oct 24, 2016, 08:07 AM • Last activity: Jul 30, 2022, 06:36 PM
1 votes
1 answers
991 views
Can msmtp rewrite *all* recipient addresses?
I'm using msmtp to deliver system email from an Ubuntu server via an SMTP account. Can I somehow configure this setup to rewrite **all** emails to one specific **recipient address**? If so, how? Or put differently, I don't want any arbitrary PHP script or otherwise to be able to send email to anybod...
I'm using msmtp to deliver system email from an Ubuntu server via an SMTP account. Can I somehow configure this setup to rewrite **all** emails to one specific **recipient address**? If so, how? Or put differently, I don't want any arbitrary PHP script or otherwise to be able to send email to anybody that is not me. I should be the only person that receives any email generated by any script on the server. All while only using msmtp (not using postfix or some other server).
chmac (140 rep)
Sep 15, 2021, 10:43 AM • Last activity: Jun 29, 2022, 06:03 AM
8 votes
1 answers
1608 views
Can msmtp rewrite addresses?
I am trying to get all my system emails to be forwarded to my gmail address, using `msmtp 1.8.3` and `/etc/aliases` on debian. It works, but I get errors from gmail. When I email `root` (via `echo "hello world" | mail -s "forward me" root`), I obtain 2 emails in the inbox of the gmail address: 1. Th...
I am trying to get all my system emails to be forwarded to my gmail address, using msmtp 1.8.3 and /etc/aliases on debian. It works, but I get errors from gmail. When I email root (via echo "hello world" | mail -s "forward me" root), I obtain 2 emails in the inbox of the gmail address: 1. The expected forwarded email 2. The following message from mailer-daemon@googlemail.com
Address not found
Your message wasn't delivered to root@backupbox because the domain backupbox couldn't be found. Check for typos or unnecessary spaces and try again.
The response was:

DNS Error: 5452395 DNS type 'mx' lookup of backupbox responded with code NXDOMAIN Domain name not found: backupbox
Obviously, it is not surprising that gmail cannot reach root@backupbox, since from their perspective, backupbox is not a fully qualified domain name. I am however surprised, because I aliased all my system addresses to my gmail address. Here is my msmtp configuration: # /etc/msmtprc defaults port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt account gmail host smtp.gmail.com from me@gmail.com auth on user me password xxxxxxxxxxxxxxxx account default : gmail aliases /etc/aliases Here are my system aliases # /etc/aliases default: me+backupbox@gmail.com How do I make sure that only the first email reaches me? For example, can msmtp rewrite root@backupbox as me@gmail.com?
user48678 (209 rep)
Dec 5, 2019, 10:55 PM • Last activity: Sep 16, 2021, 11:22 AM
1 votes
1 answers
689 views
MSMTP : How can I set a from field?
I have installed [msmtp][1], and it seems to be working OK: echo "Hello" | mail -s "Testing SmSMTP" destination@gmail.com The email arrives to destination, But the `From` field is a **ugly** email text like `johnsmithsales@hotmail.com` . I mean: `johnsmithsales@hotmail.com` is **correct**, of course...
I have installed msmtp , and it seems to be working OK: echo "Hello" | mail -s "Testing SmSMTP" destination@gmail.com The email arrives to destination, But the From field is a **ugly** email text like johnsmithsales@hotmail.com . I mean: johnsmithsales@hotmail.com is **correct**, of course, but I would like the receiver to read some **more professional** John Smith - Sales Department , like it can be done on any other email client. What is the **proper way** to achieve this with MSMTP? **Further notes**: - I am running **Ubuntu** v20.04 . - I have installed the **packages** msmtp msmtp-mta mailutils.
Sopalajo de Arrierez (6821 rep)
Jul 1, 2021, 11:38 PM • Last activity: Jul 1, 2021, 11:45 PM
2 votes
1 answers
3716 views
Send email with mailx/msmtp only works for root user
I'm struggling to find a solution. I installed heirloom-mailx and msmtp following this [site][1]. I can send emails (using gmail) as root user. The problem is with non-root user: the messages go to a queue folder (/var/spool/mqueue) and never are sent. I have little experience with linux. Could you...
I'm struggling to find a solution. I installed heirloom-mailx and msmtp following this site . I can send emails (using gmail) as root user. The problem is with non-root user: the messages go to a queue folder (/var/spool/mqueue) and never are sent. I have little experience with linux. Could you help me? System: Cubieboard 1 - Armbian Legacy Jessie server 3.4.112 .mailrc set sendmail="/usr/bin/msmtp" set message-sendmail-extra-arguments="-a gmail" ======================================================================================== .msmtprc #Gmail account defaults logfile ~/msmtp.log account gmail auth on host smtp.gmail.com from XXX@gmail.com auth on tls on # tls_trust_file /etc/ssl/cert.pem tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt user XXX@gmail.com password XXX port 587 account default : gmail ======================================================================================== /var/log/mail.info Oct 30 21:08:52 localhost sm-mta: u9U129DY004614: to=, ctladdr= (0/0), delay=22:06:43, xdelay=00:00:00, mailer=esmtp, pri=11910461, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com. mail.log: Nov 1 20:08:27 localhost sendmail: uA1M8RXu015107: from=debian-transmission, size=380, class=0, nrcpts=1, msgid=, relay=debian-transmission@localhost Nov 1 20:08:27 localhost sm-mta: uA1M8RiY015111: from=, size=628, class=0, nrcpts=1, msgid=, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1] Nov 1 20:08:27 localhost sendmail: uA1M8RXu015107: to=XXX@gmail.com, ctladdr=debian-transmission (107/114), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30380, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (uA1M8RiY015111 Message accepted for delivery) Nov 1 20:13:43 localhost sm-mta: uA1M8RiY015111: to=, ctladdr= (107/114), delay=00:05:16, xdelay=00:05:16, mailer=esmtp, pri=120628, relay=alt4.gmail-smtp-in.l.google.com. [74.125.130.27], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com. Debian-transmission is an user created by transmission. Transmission calls the bellow script after downloading: printf "The torrent $TR_TORRENT_NAME was downloaded successfully at $TR_TIME_LOCATIME" | /usr/bin/mailx -s "Transmission downloaded : $TR_TORRENT_NAME" XXX@gmail.com Maybe I could add the mailrc and msmtprc parameters to the script?
shinjidf (21 rep)
Nov 1, 2016, 05:56 PM • Last activity: May 1, 2021, 02:33 AM
3 votes
2 answers
7087 views
Configuring mail command to use msmtp
msmtp is successfully installed and works fine to send emails via an external SMTP server. However the mail command fails to send emails using *GNU Mailutils* on a Debian 10. for example echo "Test" | mail personal@external.email returns mail: cannot send message: Process exited with a non-zero stat...
msmtp is successfully installed and works fine to send emails via an external SMTP server. However the mail command fails to send emails using *GNU Mailutils* on a Debian 10. for example echo "Test" | mail personal@external.email returns mail: cannot send message: Process exited with a non-zero status and echo $? returns "36" I'm supposing this is a msmtp is not integrating with the mail command. How do I configure mail to send messages through msmtp? EDIT: The programs seem to be communicating because the keyring prompt pops up and the login options are set only in ~/.msmtprc
JBC (61 rep)
Mar 21, 2021, 03:10 AM • Last activity: Apr 4, 2021, 10:28 PM
2 votes
1 answers
1331 views
msmtp: cannot send message: Process exited with a non-zero status
I recently set up a new Pi 4 (running Buster) and installed msmtp and mailutils. I previously did this on two other Pi4s (also running Buster) on which this has worked perfectly. On the new machine it fails. I must have done something wrong, but I can't figure out what it is: Fails: ``` pi@raspmount...
I recently set up a new Pi 4 (running Buster) and installed msmtp and mailutils. I previously did this on two other Pi4s (also running Buster) on which this has worked perfectly. On the new machine it fails. I must have done something wrong, but I can't figure out what it is: Fails:
pi@raspmountain:~ $ mail me@mac.com
Cc:
Subject: sub
body
cannot send message: Process exited with a non-zero status
Works:
pi@raspsky:~ $ mail me@mac.com
Cc:
Subject: sub
body
pi@raspsky:~ $
Here's the log entry for the one that works:
Mar 11 14:53:30 host=smtp.gmail.com tls=on auth=on user=me 
from=pi@raspsky recipients=me@mac.com mailsize=132 
smtpstatus=250 smtpmsg='250 2.0.0 OK  1615449210 
c193sm1615010pfc.180 - gsmtp' exitcode=EX_OK
The one that fails does not result in any log entries. On the new Pi I used the exact same configuration file as on the older Pi: This is the one that works:
pi@raspsky:~ $ ls -la .msmtprc
-rw------- 1 pi pi 613 May 29  2020 .msmtprc
This is the one that doesn't:
pi@raspmountain:~ $ ls -la .msmtprc
-rwxr--r-- 1 pi pi 613 Feb 22 05:46 .msmtprc
Mail points to the same binary on both machines:
pi@raspmountain:~ $ ls -la /etc/alternatives/mail
lrwxrwxrwx 1 root root 23 Mar 11 13:34 /etc/alternatives/mail -> /usr/bin/mail.mailutils
pi@raspsky:~ $ ls -la /etc/alternatives/mail
lrwxrwxrwx 1 root root 23 Oct 21  2019 /etc/alternatives/mail -> /usr/bin/mail.mailutils
What have I done wrong here?
Buadhai (257 rep)
Mar 11, 2021, 08:23 AM • Last activity: Mar 14, 2021, 01:52 PM
3 votes
1 answers
2228 views
How to send mail via console on OpenBSD using a Gmail account?
There is a certificate error: # echo "hello" | msmtp -a default DESTINATION@gmail.com msmtp: TLS certificate verification failed: unable to get local issuer certificate msmtp: could not send mail (account default from /root/.msmtprc) # In the config file: # cat .msmtprc # Set default values for all...
There is a certificate error: # echo "hello" | msmtp -a default DESTINATION@gmail.com msmtp: TLS certificate verification failed: unable to get local issuer certificate msmtp: could not send mail (account default from /root/.msmtprc) # In the config file: # cat .msmtprc # Set default values for all following accounts. defaults auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log # Gmail account gmail host smtp.gmail.com port 587 from FOOBAR@gmail.com user FOOBAR password BARFOO # Set a default account account default : gmail # But I have the cert there! # uname -mrs OpenBSD 6.0 amd64 # # cksum /etc/ssl/cert.pem /etc/ssl/certs/ca-certificates.crt 1384454833 189049 /etc/ssl/cert.pem 1384454833 189049 /etc/ssl/certs/ca-certificates.crt # The log only says: # cat .msmtp.log Aug 22 20:43:14 host=smtp.gmail.com tls=on auth=on user=FOOBAR from=FOOBAR@gmail.com recipients=DESTINATION@gmail.com errormsg='TLS certificate verification failed: unable to get local issuer certificate' exitcode=EX_UNAVAILABLE # Why couldn't it recognize the cert?
Peter (531 rep)
Aug 29, 2017, 07:40 AM • Last activity: Jul 13, 2020, 12:00 AM
0 votes
1 answers
193 views
How do I send emails via msmtp from inside XEN DOM0
I have a XEN server with someVMs, one of them is the email server. How do I tell DOM0 to send all root emails to my administration email, which is inside the email-VM? I tried install `msmtpd` and added the config file `/etc/msmtprc`: ``` # A system wide configuration file is optional. # If it exist...
I have a XEN server with someVMs, one of them is the email server. How do I tell DOM0 to send all root emails to my administration email, which is inside the email-VM? I tried install msmtpd and added the config file /etc/msmtprc:
# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# The SMTP smarthost
host mail.myOtherVM.de

# Use TLS on port 465
port 587
tls on
tls_starttls on

# Construct envelope-from addresses of the form "user@oursite.example"
from %U@oursite.example

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
syslog LOG_MAIL
But When trying to send an email with echo -e "Subject: msmtp test\nhello test." | msmtp rubo77@mydomain.de on my email VM I get the error:
lost connection after DATA from unknown[2a01:xxxx:1d02::2]
disconnect from unknown[2a01:xxxx:1d02::2] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 commands=4/6
(I also tried port 465 but that one is not open at all.)
rubo77 (30435 rep)
Jul 10, 2020, 10:12 PM • Last activity: Jul 11, 2020, 08:12 PM
2 votes
0 answers
600 views
msmtp with iCloud account doesn't work
I'm very new to Linux (Raspbian at Raspberry Pi 4 Model B) and I just try to send an e-mail via command line. Right now, this is working with `msmtp` and a `gmx.de` account following [this][1] guide. apt-get update && apt-get upgrade -V apt-get install msmtp msmtp-mta mailutils > **/etc/msmtprc** an...
I'm very new to Linux (Raspbian at Raspberry Pi 4 Model B) and I just try to send an e-mail via command line. Right now, this is working with msmtp and a gmx.de account following this guide. apt-get update && apt-get upgrade -V apt-get install msmtp msmtp-mta mailutils > **/etc/msmtprc** and **~/.msmtprc** contains # Set default values for all following accounts. defaults port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile ~/.msmtp.log # Mail account account my_name@gmx.de host mail.gmx.net from my_name@gmx.de auth on user my_name@gmx.de password PASSWORD account default : my_name@gmx.de aliases /etc/aliases > **/etc/aliases** contains root: my_name@gmx.de default: my_name@gmx.de > **/etc/mail.rc** contains set sendmail="/usr/bin/msmtp -t" **1. Test** echo "Content of the e-mail" | mail -s "Subject" my_name@gmx.de This works pretty well! But if I change this to my iCloud account the authentication fails (password is correct ;)). # Set default values for all following accounts. defaults port 587 tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt # Mail account account my_name@icloud.com host smtp.mail.me.com from my_name@icloud.com auth on user my_name@icloud.com password PASSWORD account default : my_name@icloud.com aliases /etc/aliases **2. Test** pi@raspberrypi:~ $ echo "Content of the e-mail" | mail -s "Subject" my_name@icloud.com msmtp: authentication failed (method PLAIN) msmtp: server message: 535 5.7.8 Error: authentication failed msmtp: could not send mail (account default from /home/pi/.msmtprc) mail: Sending data to /usr/bin/msmtp -t failed: Process exited with a non-zero status mail: cannot send message: Process exited with a non-zero status Is there anything I can do now? Any help is appreciated!
Pascal (125 rep)
Apr 14, 2020, 05:11 PM
7 votes
1 answers
1543 views
msmtp Empty TO and FROM Field - All mail ends up in Bulk Mail when sent from CLI or manually
I have set up MSMTP with the following but if I send an e-mail from the CLI it either gets blocked, or ends up in my SPAM because it has no TO/FROM or anything up top. But e-mails from CRON are properly formatted. sudo apt-get update sudo apt-get install -y msmtp msmtp-mta # MSMTPRC Configuration ca...
I have set up MSMTP with the following but if I send an e-mail from the CLI it either gets blocked, or ends up in my SPAM because it has no TO/FROM or anything up top. But e-mails from CRON are properly formatted. sudo apt-get update sudo apt-get install -y msmtp msmtp-mta # MSMTPRC Configuration cat /etc/msmtprc # Set default values for all following accounts. defaults auth on tls on tls_trust_file /etc/ssl/certs/ca-certificates.crt logfile /var/log/msmtp.log aliases /etc/aliases # Comcast account Comcast host smtp.hmc1.comcast.net port 587 from USER@COMCAST user USER@COMCAST password PWD account default : Comcast EOL # Set Strong Permissions due to Plain Text PWD sudo chmod 600 /etc/msmtprc # Configure User Alias cat /etc/aliases # Example aliases file # Send root to Joe and Jane #root: joe_smith@example.com, jane_chang@example.com # Send everything else to admin #default: admin@domain.example # Send cron to Mark #cron: mark_jones@example.com ############################# root : sysalert@company.com EOL # Needed for Mail Command cat /tmp/testfile To: john@company.com From: server@company.com Subject: E-Mail Setup Script has Completed Successfully "${HOSTNAME} Has been configued to use msmtp, this program will e-mail all CRON results automatically, but does not suporrt the "mail -s" command EOL enter image description here
FreeSoftwareServers (2682 rep)
Sep 21, 2016, 02:02 PM • Last activity: Oct 23, 2019, 07:35 PM
1 votes
0 answers
216 views
Mail command limit
I configured swatch to send alerts about threats through "mail" command. The problem is that it is sending me many same alerts, for example while I'm testing ping I can get like 8 e-mails etc. Does anyone know how to limit amount of mails being sended about one alert?
I configured swatch to send alerts about threats through "mail" command. The problem is that it is sending me many same alerts, for example while I'm testing ping I can get like 8 e-mails etc. Does anyone know how to limit amount of mails being sended about one alert?
luqson7 (11 rep)
Oct 17, 2019, 01:17 PM
3 votes
2 answers
5008 views
Multiple smtp accounts with mutt and msmtp
I use `mutt` with two different *imap* accounts, and have configured smtp accounts **A** and **B** with `msmtp` and `mutt`. If I don't specify a default account in `.msmtprc`, `mutt` complains there is no default account when I try to send. If I set a default account **A**, `mutt` uses this for all...
I use mutt with two different *imap* accounts, and have configured smtp accounts **A** and **B** with msmtp and mutt. If I don't specify a default account in .msmtprc, mutt complains there is no default account when I try to send. If I set a default account **A**, mutt uses this for all imap accounts. *How can I make it use the smtp account **B** for the corresponding imap account?* In the account **B** mutt config file I've set the following: ## sent set sendmail="/usr/bin/msmtp" set use_from=yes set realname="My Name" set from=my@gmail.com set hostname="gmail.com" set ssl_force_tls=yes set imap_pass=$my_pass unset ssl_starttls in .msmtprc the account configuration reads: defaults tls on port 587 [...] account gmail tls_fingerprint 39:7C:59:20:DE:55:51:F4:8B:72:1D:B5:B2:26:8A:D1:DB:90:C6:28:80:77:F9:B5:EC:C1:BF:1C:6F:4D:A1:63 from my@gmail.com host smtp.gmail.com auth on user my@gmail.com passwordeval gpg2 --no-tty -q -d ~/mygmail.gpg
lash (811 rep)
Aug 10, 2017, 09:52 AM • Last activity: Sep 16, 2019, 08:55 PM
-1 votes
1 answers
119 views
finding which program produces a log file
I am using Ubuntu 15.10 and I have an email account configured on the terminal. Probably a left-over from the time I tried to configure that account, I have some logs being printed to a file in my home directory a couple of times day. An example of a log (one line, split here for readability): 28 12...
I am using Ubuntu 15.10 and I have an email account configured on the terminal. Probably a left-over from the time I tried to configure that account, I have some logs being printed to a file in my home directory a couple of times day. An example of a log (one line, split here for readability): 28 12:36:02 host=smtp.gmail.com tls=on auth=on user=***@gmail.com from=***@gmail.com recipients=&&& smtpstatus=553 smtpmsg='553 5.1.2 The recipient address is not a valid RFC-5321 address. q65sm28155223wmd.6 - gsmtp' errormsg='recipient address &&& not accepted by the server' exitcode=EX_DATAERR It is printed to ~/msmtp.log My question is how can I discover where does this printing comes from in order to kill it? Solution: The log was printed by msmtp itself. A quick look at the msmtp manfile showed that the configuration file is ~/.msmtprc . I edited this file to change the log file.
amit levin (1 rep)
Nov 28, 2016, 10:43 AM • Last activity: Nov 28, 2016, 11:03 AM
Showing page 1 of 19 total questions