Sending email through Gmail with mailx gives error "Send options without primary recipient specified"

2

I am trying to send an email with a Bash script with my Gmail account using mailx. I have the following code in the script:

mailx -v -s "$SUBJECT"  
-S smtp-use-starttls  
-S ssl-verify=ignore  
-S smtp-auth=login  
-S smtp=smtp://smtp.gmail.com/587  
-S from="$SENDER"  
-S smtp-auth-user="$SENDER"  
-S smtp-auth-password="$PASSWORD"  
$RECEIVER

This gives me the error Send options without primary recipient specified. I thought the last line was the primary recipient. How can I send this email?

user1049697

Posted 2013-04-30T18:15:40.700

Reputation: 601

The last argument is the primary recipient. Do you have a backslash (\) at the end of every line but the last? – Scott – 2014-07-15T18:06:04.180

The last line is ineded the primary recipient - unless the variable happens to be empty, or contain whitespace, in which case things get more complicated. Where is $RECEIVER set in the script? (Ideally provide the entire script, except your password) – Gabe – 2013-05-02T16:08:35.137

Answers

2

I just had a similar problem.

In my case it was due to a newline at the end of an email list causing mailx to receive an empty address.

joe

Posted 2013-04-30T18:15:40.700

Reputation: 21