Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Oct 2017 06:08:51 +0000
From:      Manish Jain <bourne.identity@hotmail.com>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Scripting problem
Message-ID:  <VI1PR02MB1200B33C1F59A223B84E9153F6770@VI1PR02MB1200.eurprd02.prod.outlook.com>
In-Reply-To: <7AB396F429EEB6890100F082@Pauls-MacBook-Pro.local>
References:  <7AB396F429EEB6890100F082@Pauls-MacBook-Pro.local>

next in thread | previous in thread | raw e-mail | index | archive | help


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@tx.rr.com < /dev/null
> 
> Right before this line are these lines:
> MESSAGE="path/to/message.txt"
> ADDRESS="pschmehl@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@hostname and 
> backup@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


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?VI1PR02MB1200B33C1F59A223B84E9153F6770>