Scripting problem
Manish Jain
bourne.identity at hotmail.com
Sun Oct 8 06:08:56 UTC 2017
On 10/08/17 11:29, Paul Schmehl wrote:
> I'm writing a bash script to create a db backup and email it to me once
> a day. I'm munged some parts to not reveal details
>
> I'm having a problem with this line:
>
> /usr/local/bin/mutt -s $SUBJECT -i $MESSAGE -a $FILENAME --
> pschmehl at tx.rr.com < /dev/null
>
> Right before this line are these lines:
> MESSAGE="path/to/message.txt"
> ADDRESS="pschmehl at mydomain"
> SUBJECT="Today's db backup"
>
>> From the commandline this runs fine, but the script returns an error:
>
> Error sending message, child exited 67 (User unknown.).
> Could not send the message.
>
> The mail is sent, and when it's received, the subject line is Today's.
> When I look in the maillog, mutt tried to send email to db at hostname and
> backup at hostname.
>
> I changed the subject to Backup, and the error goes away.
>
> I'm running FreeBSD 10.3-RELEASE and the script is written in bash.
>
> Why would mutt do this?
I do not use mutt (one of the most unfriendly Unix apps) so I cannot
comment on what is the problem here. But I would to suggest one thing to
you for CLI mail : use the port/pkg smtp-cli
Here is a working sample for mail with attachment (bundled into the bash
shell array att) :
smtp-cli \
--ipv4 \
--auth \
--server="$SMTP" \
--port=$PORT \
--user="$fromaddr" \
--pass="$password" \
--from="$fromname <$fromaddr>" \
--to="$sendto" \
--subject="$subject" \
"${att[@]}"
If this solves your problem, good luck : - )
Regards
Manish Jain
More information about the freebsd-questions
mailing list