email response

ppa - March 20, 2006 - 17:04

Hi
I have the problem in responding automatic email response after create a new user. Although i set in the smtp setting, it doesn't work. Where should i check it for? Please advise me. Thanks in advance.

phpmailer

Michael M - March 20, 2006 - 17:15

I had similar problems. There are actually many forum topics covering this issue.

The problem is the configuration of the webserver or php or sendmail/gmail. The simplest fix is to change which smtp mailer is used in drupal.

Goto:
http://drupal.org/node/7294

and download the phpmailer.zip file. Read the "readme" file and follow the instructions.

----
http://LandCondos.com

php mailer

ppa - March 22, 2006 - 02:19

Hi
I downloaded the zip file that you suggest and i could not find some files to modify. for instance,
3) modify conf.php and add following line:
$conf["smtp_library"] = "includes/phpmailer.inc";
where is that conf.php file? where should i add the above line?Can you please guide me in detail? I'm using Apache server and php ver. 5.
Thank you.

Those instructions are for

Michael M - March 22, 2006 - 22:29

Those instructions are for Drupal 4.5. You need to add that line to the sites/default/settings.php file.
1. Add this line to the settings.php file:

<?php
$conf
["smtp_library"] = "includes/phpmailer.inc";
?>

2. Upload a file called phpmailer.inc into the includes directory. Modify it to your settings. Sometimes, you might not have to modify anything. If you don't have it, it looks like this:

<?php
include_once 'includes/phpmailer/class.phpmailer.php';

function
user_mail_wrapper($mail, $subject, $message, $header) {
 
$mailer = new PHPMailer();                 // instantiate a new mailer
 
$mailer->IsSMTP();                         // send via SMTP
 
$mailer->Host     = "localhost";     // SMTP server
 
$mailer->SMTPAuth = false;                 // turn on SMTP authentication

//  $mailer->Username = '';          // SMTP username
//  $mailer->Password = '';          // SMTP password
 
$mailer->AddAddress($mail);                // can only send to one recipient
 
$mailer->From     = 'noreply@example.com'; // from address (default root@localhost)
 
$mailer->FromName = 'example.com';    // from name (default 'root user')
 
$mailer->Subject  = $subject;
 
$mailer->AddCustomHeader( explode("\n", $header)); // add custom header info
  // if body is not formatted properly change str_replace - see user.module user_mail() for details
 
$mailer->Body     = $message;//str_replace("\n", "\r\n", $message); // Body of message
 
if(!$mailer->Send()){
   
watchdog('error', 'mail send error: ' . $mailer->ErrorInfo);
    return
false;
  }
  return
true;
}
?>

3. Upload the latest phpmailer files from sourceforge.net into the includes/phpmailer directory. My directory has 2 files: class.phpmailer.php and class.smtp.php

4. If you are designing modules, make sure you send email via the user_mail function like this:

<?php
if (user_mail($email, $subject, $message, "")) {
 
drupal_set_message("Your message was sent to ". $email);
} else {
 
drupal_set_message("Your message could not be sent to ". $email, "error");
}
?>

Complement of information on point 3

ysanchez - June 19, 2006 - 09:39

I'm not a Linux geed and thus point 3 was difficult to achieve. I just would like to precise the includes/phpmailer directory is related to the PHP installation, not Drupal. E.g. in my case, the absolute path was: \lib\php\includes\phpmailer.

Actually, it is in the

Michael M - June 19, 2006 - 16:22

Actually, it is in the drupal path, not the php path.

I think that the method you described (putting it in the php path) works because you configured PHP to use that. We are configuring drupal to use phpmailer.

----
http://PointHomes.com

How to fix 2 warnings

leed - August 12, 2006 - 02:43

Does this work also when tested on localhost?
I may have made a mistake but I am getting 2 warnings.

    * warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\XAMPP\xampp\htdocs\xampp\drupal\includes\phpmailer\class.smtp.php on line 105.
    * warning: fsockopen() [function.fsockopen]: unable to connect to host.domain.ext:25 (Unknown error) in C:\XAMPP\xampp\htdocs\xampp\drupal\includes\phpmailer\class.smtp.php on line 105.

warnigs fixed

leed - August 12, 2006 - 13:23

I just fixed 2 warnings I had.
I forgot to change HOST to localhost.
Am I supposed to get an e-mail when I create a new account on localhost?

 
 

Drupal is a registered trademark of Dries Buytaert.