Answers.Body: <p>OK, the answer turns out to be a matter of capitalization. I'm using the cv addon (<a href="https://github.com/civicrm/cv" rel="nofollow noreferrer">https://github.com/civicrm/cv</a>) to send the command "job.execute" from cron. My cron line looks like:</p>
  
  <pre><code>cv api job.execute --user=username --cwd=/var/www/html/sites/default
  </code></pre>
  
  <p>However, my username on the server is not capitalized while my Username in Drupal IS capitalized. When I changed the cron to "--user=Username" all is well. It is interesting that the cron WAS executing and that the commands were being fired, thus the entries in the CiviCRM logs. However, since Drupal was seeing "username" as an unauthenticated user without the authority to send email, even though the process_mailing command was working, SMTP was failing.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-27T20:11:46.460Z
Answers.LastActivityDate: 2018-11-27T20:11:46.460Z
Answers.UserDisplayName: Stephen Sloan
Body: <p>Using Drupal 7 and Civi 5.7.0</p>
  
  <p>When sending batch emails using CiviMail, if I select "Administer CiviCRM » Scheduled Jobs" and select "Process now" on the "Send Scheduled Mailings" job then the mailing sends successfully. If I allow the cron to execute the same job, then I'm getting an SMTP error ("Failed to set sender" and "authentication failure") and the mailing fails. The log entries for the two jobs are identical. The SMTP settings are correct. The user specified in the cron job is the same as the one I'm using to "Process now".</p>
  
  <p>Note: I recently dealt with the time zone error described in <a href="https://civicrm.stackexchange.com/questions/25819/process-mailing-processing-addresses-when-called-in-ui-but-not-cron">process_mailing processing addresses when called in UI but not CRON</a> This got my cron running the process_mailing job but now I'm getting the SMTP error. The only change I made was to set the timezone on the server to the same as Drupal.</p>
  
Tags: <civimail><cron>
Title: Problem with process_mailing
ThreadText: # Problem with process_mailing
  
  (Asked by: username_0 on 2018-11-26)
  
  Using Drupal 7 and Civi 5.7.0
  
  When sending batch emails using CiviMail, if I select "Administer CiviCRM » Scheduled Jobs" and select "Process now" on the "Send Scheduled Mailings" job then the mailing sends successfully. If I allow the cron to execute the same job, then I'm getting an SMTP error ("Failed to set sender" and "authentication failure") and the mailing fails. The log entries for the two jobs are identical. The SMTP settings are correct. The user specified in the cron job is the same as the one I'm using to "Process now".
  
  Note: I recently dealt with the time zone error described in [process\_mailing processing addresses when called in UI but not CRON](https://civicrm.stackexchange.com/questions/25819/process-mailing-processing-addresses-when-called-in-ui-but-not-cron) This got my cron running the process\_mailing job but now I'm getting the SMTP error. The only change I made was to set the timezone on the server to the same as Drupal.
  
  **Tags:** civimail, cron
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-11-27. Score: 1 | Accepted answer
  
  OK, the answer turns out to be a matter of capitalization. I'm using the cv addon (<https://github.com/civicrm/cv>) to send the command "job.execute" from cron. My cron line looks like:
  
  ```
  cv api job.execute --user=username --cwd=/var/www/html/sites/default
  
  ```
  
  However, my username on the server is not capitalized while my Username in Drupal IS capitalized. When I changed the cron to "--user=Username" all is well. It is interesting that the cron WAS executing and that the commands were being fired, thus the entries in the CiviCRM logs. However, since Drupal was seeing "username" as an unauthenticated user without the authority to send email, even though the process\_mailing command was working, SMTP was failing.
  
  
  ---
  
  