Hi every body,
I have been trying to make drupal send mail via an external smtp mail server, after reading a lot of posts on this forum I found one talking about smtp.module, so I installed it, I created a new account and the registration mail was delivered successfully to the e-mail address. So smtp.module works.
Then I installed simplenews module and I created a newsletter and added 2 testing susbcriptors, then send the news letter and in the next page I get the message: "Se ha creado su newsletter." (I am spanish so I am using the spanish translation :P ) that means something like "Your newsletter has been succesfully created" but when I look into the log at the administer menu I see 2 errors:
error simplenews 2006-03-14 12:51 Newsletter porca miseria could not be sent to +++@****.---
error simplenews 2006-03-14 12:51 Newsletter porca miseria could not be sent to 000@****.---
I do not post the original e-mail addresses in order to avoid spam. But the original addresses are right.
Any Idea of what could be happening?
Thanks :)
Martin.
P.D.: I use Apache 2.0.55, PHP 4.4.2 and Drupal 4.6.5
Comments
The solution
I solved the problem.
I post here the solution I found and I hope this could help someone else.
I saw the post at http://drupal.org/node/29888 and I decided to try. I dissabled the smtp.module and installed class.smtp.inc and smt.inc as indicated on that post. I tried to add a new user account and the registration e-mail was delivered succesfully. But the module simplenews still didn't work so I decided to gon into the source code.
At file simplenews.module I found the code that sends the newsletters
As you can see the $email->Send(); sends the e-mail, and it is defined in the file activeMailLib.php so I investigated a bit on that file and found out that it uses the php function mail() to send mail, and it dissabled on most systems, so I changed the mail() call for the one defined in Drupal user_mail()
Here is the code that I changed in activeMailLib.php:
One last thing... the from_address and from_name of the e-mail is extracted from the information defined in the section administer->settings from drupal, be sure that the fields Name and e-mail for the site are filled, if not the e-mail won't be delivered.
If anyone has troubles with something similar I would gladly help him. You can contact me at: marpemar(at)iti(dot)upv(dot)es
That works
Thanks; I was having the same problem and your hack solved it for me.
John
ps Can you translate for me: "Hay problemas con mailto y mailfrom ve a administer->settings y establece un nombre y un mail para el sitio"
This means:
There are troubles with the mailito and mailfrom fields go to administer->settings and set a name and a email for the site.
Help!!!
Hi i try everything you say here and i get this error: "mail connect error: EHLO command failed"
my configurations is:
in class.smtp.inc
$this->host = 'smtp.google.com';
$this->helo = 'smtp.google.com';
$this->auth = TRUE;
$this->user = (my gmail username);
$this->user = (my gmail password);
in smtp.inc
$params['host'] = ini_get('SMTP');
// The smtp server port
$params['port'] = 465;
// What to use when sending the helo command. Typically, your domain/hostname
$params['helo'] = $_SERVER['HTTP_HOST'];
// Whether to use basic authentication or not
$params['auth'] = true;
// Username for authentication
$params['user'] = (my gmail username);
// Password for authentication
$params['pass'] = (my gmail password);
in my .htaccess
php_value SMTP smtp.gmail.com
php_value smtp_port 465
Any ideas will be most welcome.
Oh i forget to ask, what is
Oh i forget to ask, what is exactly the ehlo param??
Some clues...
Hi Damian,
I've been taking a look to what you say. It seems that it successfully
gets the socket connection to smtp.google.com (otherwise the error "mail
connect error: Failed to connect to server" but for some reason the EHLO
command fails.
Is "mail connect error: EHLO command failed" all the information that
the error message gives to you? I've been checking class.smtp.inc and
the sourcecode says:
So the error message should be something like this: "mail connect error:
EHLO command failed, output: ************"
The version of class.smtp.inc I am using is 1.0.5
The content of the variable $error would be very informative.
By the way you could check some things:
- Check the value returned by ini_get('SMTP')
- Check the value returnd by $_SERVER['HTTP_HOST']
- I have no account at gmail but the smtp server is smtp.google.com or
smtp.gmail.com?
- Gmail smtp server uses TSL, I've never dealed with that.
Answering to you question: Oh i forget to ask, what is exactly the ehlo
param??
The command HELO usually is the first command sent to the smtp server,
followed by your hostname. The only difference with EHLO is that if the
command EHLO is accepted the response of the server provides
computer-readable information about the server's abilities.
I hope that this give you some clues :)
Regards.
will this work with drupal 4.7?
I tried changing activeMailLib.php as suggested in your reply.
But I get an error when sending test emails.
It is saying there is an unexpepcted variable.
Could it be that there are extra spaces?
Its working now. But I am
Its working now.
But I am getting the ff error message:
5.7.1 ... SMTP relay denied, authenticate via POP/IMAP first
5.0.0 Need RCPT (recipient)
I guess I have to configure the mail server yet since it is on another domain.
Any idea how to translate
Any idea how to translate this across to 5.x verson of simplenews? The code pretty looks different.
Hydrant Ltd
www.hydrant.co.uk
I'd be interested in seeing
I'd be interested in seeing it for 6.x