Mail sent after the test email received is also received
No mail sent during setup is received, except initial test.
Every time the setup says it is sending mail there is an error:
mail: invalid option -- '-'
Nextcloud server version: Nextcloud 20.0.2 (although installer was 20.0.1 and it updated)
Server OS Ubuntu server
How did you install the VM? Released version
Do you use DHCP? Yes
Is port 80 and/or 443 open? Yes
Received test

On of the many exact same errors during setup sending mail

https://0bin.net/paste/hvOTicSf#dqg4206hr85qg7tXoC7o32vqpP1151EoX7V+I6rgr4p
N/A here
cc @szaimen
@lantrix I can unfortunately not reproduce this. Have you tried to reinstall it? Maybe this fixes the problem...
Could you please post your mail logs:
/var/log/msmtp
Also it would be interesting what is inside
/etc/mail.rc
Thanks!
Thanks @szaimen I'll reinstall it, and see if it happens again.
I'll also grab a copy of the logs if it does again.
Did the reinstall of 20.0.2 and same problem exactly. Into email works, rest error with:
mail: invalid option -- '-'
usage: mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr] [-s subject] [--] to-addr ...
mail [-dEIiNnv] -f [name]
mail [-dEIiNnv] [-u user]
/var/log/msmtp is:
mail: /usr/bin/msmtp -t: No such file or directory
Can't send mail: sendmail process failed with error code 1
Dec 06 22:49:15 host=smtp.pobox.com tls=on auth=on [email protected] [email protected] [email protected] mailsize=1119 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 6C1E89EEA3' exitcode=EX_OK
/etc/mail.rc is:
set sendmail="/usr/bin/msmtp"
I've manually imported the lib.sh into a root session to test send_mail "subject" "message" function in the library.
Same error
root@cloud:~# send_mail "subject" "text"
Sending 'subject' to [email protected]
mail: invalid option -- '-'
usage: mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr] [-s subject] [--] to-addr ...
mail [-dEIiNnv] -f [name]
mail [-dEIiNnv] [-u user]
Breaking down the function and running it manually, this line is the one failing:
root@cloud:~# RECIPIENT=$(grep "recipient=" /etc/msmtprc)
root@cloud:~# RECIPIENT="${RECIPIENT##*recipient=}"
root@cloud:~# echo -e "test message" | mail --subject "NcVM - test subject" "$RECIPIENT"
mail: invalid option -- '-'
usage: mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr] [-s subject] [--] to-addr ...
mail [-dEIiNnv] -f [name]
mail [-dEIiNnv] [-u user]
This DOES work:
echo -e "test message" | mail -s "NcVM - test subject" "$RECIPIENT"
The reason the welcome email works is it already uses -s in the script smtp-mail.sh