Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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://  
-S from="$SENDER"  
-S smtp-auth-user="$SENDER"  
-S smtp-auth-password="$PASSWORD"  

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?

share|improve this question
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 May 2 '13 at 16:08
The last argument is the primary recipient. Do you have a backslash (\) at the end of every line but the last? – Scott Jul 15 '14 at 18:06

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .