Answers.Body: <p>so using google smtp is fine for tests, but as bgm mentioned, it won't scale for production, as google doesn't allow you to send a lot of emails that way.</p>
  
  <p>if you have the popup, it means that civi could talk to the mail server successfully, so it's probably working and your set up is correct. What might be the issue is between gmail servers and your university final account. Can you try sending the test to a gmail address, eg the one you use as the sender too?</p>
  
  <p>And double check what email account you set as the sender, it might be as well that the sender email address is not your gmail address, so the anti-spams kills the test email somewhere on the way.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T14:36:00.943Z
Answers.LastActivityDate: 2016-05-17T14:36:00.943Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>In addition to queuing up the mail, you need to ensure that the cron job for sending them is executing. Look under Admin > System Settings > Scheduled Jobs, then check when the last time Send Scheduled Mailings ran. You may want to click on View Job Log to see if there are any issues it is having. Note that when debugging it can be convenient to click more > Execute Now, and then check the job log again.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T14:31:15.243Z
Answers.Text: it seems that the issue is there even for the tests emails, so I'd suspect the cronjob isn't the issue
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T14:00:01.863Z
Answers.LastActivityDate: 2016-05-17T14:00:01.863Z
Answers.UserDisplayName: Joe Murray
Answers.Body: <p>I think I found the issue. If your CiviCRM is installed via buildkit there is a file <code>~/buildkit/app/civicrm.settings.d/100-mail.php</code> which sets the <code>CIVICRM_MAIL_LOG</code> to <code>/dev/null</code>. This doesn't allow Civi to communicate to MTA (Mail Transfer Agent).</p>
  
  <p>The first solution is to comment out </p>
  
  <pre><code>//if (!defined('CIVICRM_MAIL_LOG')) {
  //  define('CIVICRM_MAIL_LOG', '/dev/null');
  //}
  </code></pre>
  
  <p>Further, because this is a dev/testing environment, you may want to log your emails while you send them. In your <code>civicrm.settings.php</code> add the following lines.</p>
  
  <pre><code>if (!defined('CIVICRM_MAIL_LOG')) {
  define( 'CIVICRM_MAIL_LOG', 'log_path/mail.log');
  }
  define('CIVICRM_MAIL_LOG_AND SEND', true);
  </code></pre>
  
  <p><code>CIVICRM_MAIL_LOG_AND SEND</code> allows CiviCRM to log as well as send the emails.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T20:09:08.720Z
Answers.Text: Also I used ssl://smtp.gmail.com as server and 465 as port
Answers.UserDisplayName: Siddharth Gupta
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-18T06:31:36.697Z
Answers.Text: Thanks, the solution worked and I am able to send emails now.
Answers.UserDisplayName: Anjali Ujjainia
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-19T23:22:01.943Z
Answers.Text: Fun fact -- you can override anything in `~/buildkit/app/civicrm.settings.d` by creating a file in `/etc/civicrm.settings.d`. It allows you to manipulate the settings for all builds. For example, I use this to direct mail to a log file: https://gist.github.com/totten/fa8ed564db5d336aec70cdda46ade0e1
Answers.UserDisplayName: Tim Otten
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-17T20:04:37.637Z
Answers.LastActivityDate: 2016-05-17T20:04:37.637Z
Answers.UserDisplayName: Siddharth Gupta
Body: <p>I am trying to send email using SMTP settings in the outbound email settings.
  I have set all the fields according to <a href="https://forum.civicrm.org/index.php/topic,2323" rel="nofollow noreferrer">this post</a> which would be  </p>
  
  <pre><code>SMTP server address : ssl://smtp.gmail.com  
  SMTP server port: 465  
  SMTP username: [username@gmail.com/username@yourtlddomain.com]  
  SMTP password: [yourpassword]  
  </code></pre>
  
  <p>I have also commented out CIVICRM_MAIL_LOG in the civicrm.settings.php hence my emails are not sent to a file, for sure.
  In both mail() and SMTP, the test mail is sent OK according to the popup window (view attached file). But it does not get delivered so it isn't really sent.  </p>
  
  <p><a href="https://i.sstatic.net/3hq89.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3hq89.png" alt="Settings Outbound Email"></a></p>
  
  <p>I have checked all the related questions. The closest was this <a href="https://civicrm.stackexchange.com/questions/2908/civicrm-not-sending-mails">CiviCRM not sending mails</a>
  but the outputs don't match.  </p>
  
  <p>[Edit]
  The mails work now. I have implemented the changes suggested by @Siddharth Gupta, below.
  Also to allow your gmail to send mails you need to change its security to   allow access for less secure apps from <a href="https://www.google.com/settings/security/lesssecureapps" rel="nofollow noreferrer">here</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-17T10:29:55.167Z
Comments.Text: You'll need to provide your host environment information. Are you on a shared server? VPS? Do you have postfix (or equivalent) installed? If you're on a shared server, are they allowing outbound traffic on that port? Or does your VPS have a firewall that may be blocking you?
Comments.UserDisplayName: Peter Petrik
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-17T13:19:52.947Z
Comments.Text: Can you test sending to another gmail address? Could it be that  @iiitd.ac.in is blocking the delivery of the message? Also I would not recommend using Gmail for email delivery. There are other semi-free solutions, such as SparkPost (+ CiviCRM extension).
Comments.UserDisplayName: bgm
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-17T18:19:29.517Z
Comments.Text: I think the issue is with google not allowing to use itself as SMTP account, I faced this in one of the python code I was writing. Have a look at this https://support.google.com/accounts/answer/6010255?hl=en
Comments.UserDisplayName: Siddharth Gupta
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-18T07:18:47.440Z
Comments.Text: @bgm - Tried with another email address but the problem was different. The mails were redirected to "/dev/null". Fixed that and mails are working now.
Comments.UserDisplayName: Anjali Ujjainia
Tags: <civimail><gsoc><civicrm.settings.php>
Title: Mail not sent from CiviCRM via SMTP or mail()
ThreadText: # Mail not sent from CiviCRM via SMTP or mail()
  
  (Asked by: username_0 on 2016-05-17)
  
  I am trying to send email using SMTP settings in the outbound email settings.
  I have set all the fields according to [this post](https://forum.civicrm.org/index.php/topic,2323) which would be
  
  ```
  SMTP server address : ssl://smtp.gmail.com  
  SMTP server port: 465  
  SMTP username: [username@gmail.com/username@yourtlddomain.com]  
  SMTP password: [yourpassword]  
  
  ```
  
  I have also commented out CIVICRM\_MAIL\_LOG in the civicrm.settings.php hence my emails are not sent to a file, for sure.
  In both mail() and SMTP, the test mail is sent OK according to the popup window (view attached file). But it does not get delivered so it isn't really sent.
  
  [![Settings Outbound Email](https://i.sstatic.net/3hq89.png)](https://i.sstatic.net/3hq89.png)
  
  I have checked all the related questions. The closest was this [CiviCRM not sending mails](https://civicrm.stackexchange.com/questions/2908/civicrm-not-sending-mails)
  but the outputs don't match.
  
  [Edit]
  The mails work now. I have implemented the changes suggested by @username_3, below.
  Also to allow your gmail to send mails you need to change its security to allow access for less secure apps from [here](https://www.google.com/settings/security/lesssecureapps)
  
  **Tags:** civimail, gsoc, civicrm.settings.php
  
  > **Comments:**
  > **username_1**: You'll need to provide your host environment information. Are you on a shared server? VPS? Do you have postfix (or equivalent) installed? If you're on a shared server, are they allowing outbound traffic on that port? Or does your VPS have a firewall that may be blocking you?  
  > **username_2**: Can you test sending to another gmail address? Could it be that  @iiitd.ac.in is blocking the delivery of the message? Also I would not recommend using Gmail for email delivery. There are other semi-free solutions, such as SparkPost (+ CiviCRM extension).  
  > **username_3**: I think the issue is with google not allowing to use itself as SMTP account, I faced this in one of the python code I was writing. Have a look at this https://support.google.com/accounts/answer/6010255?hl=en  
  > **username_0**: @username_2 - Tried with another email address but the problem was different. The mails were redirected to "/dev/null". Fixed that and mails are working now.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2016-05-17. Score: 9 | Accepted answer
  
  I think I found the issue. If your CiviCRM is installed via buildkit there is a file `~/buildkit/app/civicrm.settings.d/100-mail.php` which sets the `CIVICRM_MAIL_LOG` to `/dev/null`. This doesn't allow Civi to communicate to MTA (Mail Transfer Agent).
  
  The first solution is to comment out
  
  ```
  //if (!defined('CIVICRM_MAIL_LOG')) {
  //  define('CIVICRM_MAIL_LOG', '/dev/null');
  //}
  
  ```
  
  Further, because this is a dev/testing environment, you may want to log your emails while you send them. In your `civicrm.settings.php` add the following lines.
  
  ```
  if (!defined('CIVICRM_MAIL_LOG')) {
  define( 'CIVICRM_MAIL_LOG', 'log_path/mail.log');
  }
  define('CIVICRM_MAIL_LOG_AND SEND', true);
  
  ```
  
  `CIVICRM_MAIL_LOG_AND SEND` allows CiviCRM to log as well as send the emails.
  
  > **Comments:**
  > **username_3**: Also I used ssl://smtp.gmail.com as server and 465 as port  
  > **username_0**: Thanks, the solution worked and I am able to send emails now.  
  > **username_6**: Fun fact -- you can override anything in `~/buildkit/app/civicrm.settings.d` by creating a file in `/etc/civicrm.settings.d`. It allows you to manipulate the settings for all builds. For example, I use this to direct mail to a log file: https://gist.github.com/totten/fa8ed564db5d336aec70cdda46ade0e1  
  
  ---
  
  ### Answer by username_4 on 2016-05-17. Score: 2
  
  so using google smtp is fine for tests, but as bgm mentioned, it won't scale for production, as google doesn't allow you to send a lot of emails that way.
  
  if you have the popup, it means that civi could talk to the mail server successfully, so it's probably working and your set up is correct. What might be the issue is between gmail servers and your university final account. Can you try sending the test to a gmail address, eg the one you use as the sender too?
  
  And double check what email account you set as the sender, it might be as well that the sender email address is not your gmail address, so the anti-spams kills the test email somewhere on the way.
  
  
  ---
  
  ### Answer by username_5 on 2016-05-17. Score: 0
  
  In addition to queuing up the mail, you need to ensure that the cron job for sending them is executing. Look under Admin > System Settings > Scheduled Jobs, then check when the last time Send Scheduled Mailings ran. You may want to click on View Job Log to see if there are any issues it is having. Note that when debugging it can be convenient to click more > Execute Now, and then check the job log again.
  
  > **Comments:**
  > **username_4**: it seems that the issue is there even for the tests emails, so I'd suspect the cronjob isn't the issue  
  
  ---
  
  