-1

I have setup web in Drupal 7 and I am using webform module to create/configure the forms. The web is not sending any email including registration emails.

I tried to use the following php script to debug the root issue but couldn't-

<?php
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
$subject = 'Birthday Reminders for August';
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdaycheck@example.com' . "\r\n";
if (mail($to, $subject, $message, $headers)) {
   echo("<p>Email successfully sent!</p>");
}
else {
   echo("<p>Email delivery failed…</p>");
}
?>

The script show me successful message. I tried to check the logs at admin/reports/dblog but can't see any error log.

Since I am behind this proxy. Hence I have set the proxy in sites/default/settings.php file as following-

$conf['proxy_server'] = '192.168.68.10';
$conf['proxy_port'] = 3128;
$conf['proxy_username'] = 'myuser';
$conf['proxy_password'] = 'mypass';
$conf['proxy_exceptions'] = array('127.0.0.1', 'localhost');

The above configurations working fine as I can check for the updates after setting the proxy.

Why drupal is not sending any emails? How to debug it?

  • Do you have sendmail installed on the server? Are you on a shared host? – Ollie Mar 12 '14 at 15:18
  • To check if your mailserver is generally misconfigured, you can send yourself a password-reset mail. If the mail arrives, your code is buggy. If not, its a mailserver problem. – moertle Mar 12 '14 at 15:26
  • 1. Can you send mail directly for the CLI (e.g. using Gnu/Linux mail)? 2. Can you send mail from PHP outside of Drupal (e.g. using the PHP mail() function). – Free Radical Mar 12 '14 at 15:29
  • Currently I am on Windows 7 with XAMPP installed on my machine. I tried to send password reset mail but couldn't get any mail. I also tried to execute the php mail function on my machine (as listed above also), it shows me mail sent. However I didn't get any mail. – Ravi Joshi Mar 12 '14 at 15:45
1

While sending email, you can decide whether to host your own SMTP server or you can use the gmail SMTP server. For both include the SMTP module in your site.. configuration of gmail SMTP server is available here: https://stackoverflow.com/questions/8939238/gmail-smtp-configuration-for-drupal-7 Create a gmail account of yours and use it for your site :)

  • How does this answes address the actual question, which is "Why drupal is not sending any emails? How to debug it?"? – Pierre.Vriens Dec 12 '16 at 9:32
1

I had the same problem following a recent upgrade to the latest version of modules in Drupal 7.

It turned out that following the upgrade I had to use the same email address as the web address, i.e. if the web address is indigoextra.com, you would have to use something@indigoextra.com as the email address that emails are sent from using Mime Mail.

I'm sure this won't always fix the problem, but it's an easy check to make and you can configure this here - /admin/config/system/mimemail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.