LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 10-04-2019, 05:06 PM   #1
HighPotatoProtector
LQ Newbie
 
Registered: Oct 2019
Posts: 2

Rep: Reputation: Disabled
Cron cannot send mail


Hey everyone

Im on manjaro and recently installed timeshift for keeping a system backup. Sendmail is used as a default by cron to send output of scripts (timeshift). I installed and configured msmtp and msmtp-mta basically as described here: https://wiki.archlinux.org/index.php/Msmtp
After this, I recieve email if I test sendmail:
Code:
echo test | sendmail myuser@mymail.com
So far so good. Now I created a new cronjob by
Code:
crontab -e
and appending
Code:
* * * * * echo something
My systemlog from journalctl gives me:

Code:
Okt 04 23:49:01 myhostname CROND[5677]: (myusername) CMD (echo something)
Okt 04 23:49:01 myhostname crond[5676]: pam_unix(crond:session): session opened for user myusername by (uid=0)
Okt 04 23:49:01 myhostname kernel: audit: type=1006 audit(1570225741.109:138): pid=5676 uid=0 old-auid=4294967295 auid=1000 tty=(none) old-ses=4294967295 ses=83 res=1
Okt 04 23:48:29 myhostname crontab[5670]: (myusername) BEGIN EDIT (myusername)
Okt 04 23:48:03 myhostname CROND[5667]: pam_unix(crond:session): session closed for user myusername
Okt 04 23:48:03 myhostname CROND[5667]: (myusername) MAIL (mailed 4 bytes of output but got status 0x0041
                                            )
Okt 04 23:48:03 myhostname crond[510]: sendmail: could not send mail (account default from /etc/msmtprc)
Okt 04 23:48:03 myhostname crond[510]: sendmail: server message: 501 Syntax error in parameters or arguments
Okt 04 23:48:03 myhostname crond[510]: sendmail: envelope from address myusername not accepted by the server
I could not find anything useful so far. As in the logs i get server message: "501 Syntax error in parameters or arguments" is there a way to find out the exact sendmail command cron uses?

My /etc/msmtprc is:

Code:
# Set default values for all following accounts.
defaults

# Use the mail submission port 587 instead of the SMTP port 25.
port 587

# Always use TLS.
tls on

# Set a list of trusted CAs for TLS. The default is to use system settings, but
# you can select your own file.
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# If you select your own file, you should also use the tls_crl_file command to
# check for revoked certificates, but unfortunately getting revocation lists and
# keeping them up to date is not straightforward.
#tls_crl_file ~/.tls-crls

# Mail account
# TODO: Use your own mail address
account myuser@mydomain.com

# Host name of the SMTP server
# TODO: Use the host of your own mail account
host my.smtp.server

# As an alternative to tls_trust_file/tls_crl_file, you can use tls_fingerprint
# to pin a single certificate. You have to update the fingerprint when the
# server certificate changes, but an attacker cannot trick you into accepting
# a fraudulent certificate. Get the fingerprint with
# $ msmtp --serverinfo --tls --tls-certcheck=off --host=smtp.freemail.example
#tls_fingerprint 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33

# Envelope-from address
# TODO: Use your own mail address
from myuser@mydomain.com

# Authentication. The password is given using one of five methods, see below.
auth on

# TODO: Use your own user name fpr the mail account
user myuser@mydomain.com

# Password method 1: Add the password to the system keyring, and let msmtp get
# it automatically. To set the keyring password using Gnome's libsecret:
# $ secret-tool store --label=msmtp \
#   host smtp.freemail.example \
#   service smtp \
#   user joe.smith

# Password method 2: Store the password in an encrypted file, and tell msmtp
# which command to use to decrypt it. This is usually used with GnuPG, as in
# this example. Usually gpg-agent will ask once for the decryption password.
#passwordeval gpg2 --no-tty -q -d ~/.msmtp-password.gpg

# Password method 3: Store the password directly in this file. Usually it is not
# a good idea to store passwords in plain text files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
# TODO: Use the password of your own mail account
password mypassword

# Password method 4: Store the password in ~/.netrc. This method is probably not
# relevant anymore.

# Password method 5: Do not specify a password. Msmtp will then prompt you for
# it. This means you need to be able to type into a terminal when msmtp runs.

# Set a default account
# TODO: Use your own mail address
account default: myuser@mydomain.com

# Map local users to mail addresses (for crontab)
aliases /etc/aliases
My /etc/aliases is

Code:
myusername: myuser@mydomain.com
root: myuser@mydomain.com
default: myuser@mydomain.com

Obviously in all the above sensible information is replaced with mywhatever.

I would be grateful for some help as I have no idea for what to look or what to test anymore. Thanks!
 
Old 10-07-2019, 08:26 AM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread



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
Cron cannot send mail although sendmail is configured HighPotatoProtector Linux - Software 1 10-06-2019 07:03 PM
LAN mail clients cannot send mail (receiving mail is working) rnturn Linux - Server 2 07-22-2015 11:53 PM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:57 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