Software⏱️ 3 min read📅 2026-06-11

How to Fix: Sending email through Gmail with mailx gives error "Send options without primary recipient specified"

Error sending email with mailx due to missing primary recipient.

Quick Answer: Specify the recipient's address before the message body.

The error 'Send options without primary recipient specified' occurs when using mailx to send an email through Gmail. This issue affects users who are trying to use their Gmail account with mailx to send emails.

This error is frustrating because it prevents users from sending emails, and the solution can be complex to find. However, by following the steps outlined below, users should be able to resolve this issue.

💡 Why You Are Getting This Error

  • The primary reason for this error is that Gmail requires a 'From' address with an email address as part of the SMTP authentication process. This means that even if you specify the recipient's email address in the To field, mailx will still require the From address to be specified.
  • Another possible cause is that the Gmail account has two-factor authentication (2FA) enabled, which requires additional verification steps before sending emails.

🚀 How to Resolve This Issue

Enabling Less Secure Apps in Gmail Settings

  1. Step 1: Open the Gmail settings page by going to https://mail.google.com/ and logging in with your account.
  2. Step 2: Click on the gear icon in the upper right corner of the page and select 'See all settings'.
  3. Step 3: In the 'Account settings' tab, scroll down to the 'Less secure app access' section and toggle the switch to enable it.
  4. Step 4: Save changes and try sending the email again using mailx.

Using an App Password for Gmail Account

  1. Step 1: Go to the Google account settings page by going to https://myaccount.google.com/ and logging in with your account.
  2. Step 2: Click on the 'Security' tab and scroll down to the 'App passwords' section.
  3. Step 3: Select 'Mail' as the app type and 'Other (Custom name)' as the device type, then click 'Generate'.
  4. Step 4: You will be prompted to enter a name for the app password. Enter a descriptive name, such as 'mailx', and click 'Generate'.
  5. Step 5: Copy the generated app password and use it in place of your regular Gmail password when running mailx.

🎯 Final Words

By enabling less secure apps or using an app password, users should be able to resolve the error 'Send options without primary recipient specified' when sending emails through Gmail using mailx.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions