I have a Drupal install that works perfectly except that it never sends out an email when an user is added by the admin or self-registered.
I seem to have all the necessary modules turned on, so this is very frustrating for me and is delaying the launch of my site.
Please let me know if I am missing something?
Comments
It could be the host configuration
It could be the hosting configuration. I mean, how the hosting company configured the host.
Try to troubleshoot it outside Drupal first, with a PHP script
Change the email address below, and put the following code in a file called testmail.php in your public_html (or www) directory. Then point your browser to http://example.com/testmail.php
You could try more examples from here:
http://www.php.net/manual/en/function.mail.php
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
Thanks...
That was very helpful. I put testmail.php is on the same domain on which I am using Drupal to develop the site. Mail worked successfully and I actually received it.
But the problem with Drupal still continues. Is there anything else that could be wrong?
Is there an error in the log?
Hmmm. So it is a Drupal issue. Or the mail server on your hosting machine, or your own receiving mail server are picky about what addresses you can send from.
Here are a few things to check:
1. From the admin menus, check the logs.
Is there an error about being unable to send email to users? Or is it silent?
2. Another thing to try is pasting this code snippet into a node of type PHP, then paste the output you get when accessing the node here:
<?
$from = variable_get('site_mail', ini_get('sendmail_from'));
print "From: $from
";
$subject = "test subject";
$body = "This is a test\nThis is a test\This is a test\n";
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
$rc = user_mail($account->mail, $subject, $body, $headers);
if ($rc) {
print "Success
";
}
else {
print "Failed
";
}
?>
This is taken from user.module, and will use the function user_mail from that module, but with more description on what is going on.
Give it a try and paste the results here in this thread.
--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba
Sorry I lost track of this
Sorry I lost track of this thread.
I will try out the things you have suggested and post back.
Sorry to bring up this up
Sorry to bring up this up again, but I tried the code snippet and it returned 'Success'.
Someone also suggested checking the "SMTP settings in the php.ini file on the server" in the following thread: http://drupal.org/node/5332
I didn't do this, but checked the phpinfo() file on my server. It shows the following for local value and master value respectively:
sendmail_from me@localhost.com me@localhost.com
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
SMTP localhost localhost
Any suggestions?
Incidentally, my hosting account and the database serving Drupal are on different servers. Does this matter?
Thanks
smtp server
Some hosting companies disable the use of the mail() function when sending email to other domains, thus you may have to pass mail directly to the smtp server.
Follow the instructions in this README.txt file and let us know if that solved the problem.
Thank you very much, I was
Thank you very much, I was unaware of this trick.
I followed the instructions in the file, returned to Drupal and tested by creating a new user. I got the following message:
"Created a new user account. No e-mail has been sent."
Sigh. Wonder what else is wrong.
Nothing is wrong
The message:
"Created a new user account. No e-mail has been sent."
means that Drupal did not send an e-mail to the user since the admin created this account. It doesn't mean that Drupal was unable to send e-mail. To test whether Drupal can send email, logout and request a new password for a user you can check the e-mail of.
Oh! Thanks for the insight.
Oh! Thanks for the insight. The request password worked even earlier.
However, I signed up to create a new account as a visitor and got the following error message:
Fatal error: Call to undefined function: user_mail_wrapper() in /usr/www/users/ramdak/actfordharma/development/modules/user.module on line 338
My setting is configured to 'Visitors can create accounts and no administrator approval is required', although the original setting was that only the admin could add accounts.
Thanks
smtp.inc
Try removing the
$conf["smtp_library"] = "includes/smtp.inc";
line in your configuration file.
i am having the same problem
i am having the same problem although getting rid of the line in the config file does not work. any other suggestions?
I finally figured out that
I finally figured out that there is not much of a problem with the mail functions in Drupal. It seems more a problem with documentation and also a bit with usability design. See this post for a related discussion: http://drupal.org/node/18690
Have you set up your site so that only admins can add accounts? If so, Drupal will never send out a welcome email, although it will add the user and say he/she is authenticated.
Try changing this setting so that visitors can automatically register for an account- the email goes out immediately and everything works instantaneously. This should convince you that the email system in Drupal works, although there may be other issues based on the hosting environment.
You can change the setting by going to administer>users>configure
Let us know if this solves your problem.
it must have been late...
actually, the problem was i didn't properly define the smtp.inc file with that specific function in it. when you download file from the CVS I only got the class.smtp.inc and so there was no function being used. now all i have to do is setup or find an smtp server then the emails will be sent out.
EDIT: btw, the file i should've downloaded is located here: http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/smtp/smtp.inc?...
another way i know it works is that when i try to use non-smtp servers to send my mail i get an error like this:
anyone know of a really easy setup smtp server? preferably a daemon too because i have tried ssmtp, esmtp, nbsmtp. maybe i did somethin wrong there too.
thanks.
smtp & admin account
since i don't have a smtp server on my xp machine, how can i add a 1st user account without sending out a welcome message?
thanks
smtp.module can also solve the problem
I got the same problem as discussed here and I didn't exactly know why my drupal's site did not send any email to new registered user. Then I downloaded smtp.module and setup drupal's smtp using my username and password at my hosting server (perhaps it can be any valid smtp server but I didn't try).
Aha, it solved the problem.
Warm regards from Indonesia,
/jbudisantosa
yay it works!
thanks dude, I finally got it working =)
Thanks, solved my mailing
Thanks, the smtp module solved my mailing problem too. :)
I installed smtp.module, but it didn't solve the problem
I installed smtp.module, but it didn't solve the problem.
I've started a new thread with my specific problems here http://drupal.org/node/49513. Any help will be greatly appreciated.
ian
hmm same problem here but
hmm same problem here but now with drupal 5.1
i've used the code
but i get only a blank page with: From: info@toppop.nl ...
Http://www.reloadmedia.com
Http://www.reloadmedia.com
drupal_mail
As of drupal 5, user_mail has been replaced with drupal_mail.
ian
Fantasy Formula 1
hi
Sorry wrongly posted here but it is the reference for comment no 1 of this forum by Kbahey. I go though this forum and try your suggestion it shows me "fail to send" (when placed in the public directory) could u please tell me exactly which modules are needed for sending an email. i am working on drupal 6.2.
it is showing this error:-
mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal-6.2\includes\common.inc(1537) : eval()'d code on line 9.
SAME PROBLEM
I have the same problem like Peterw, Drupal return me an error of class.smtp.inc, the user was created but drupal cna't send mail.
Any solutions???
warning: main(includes/class.smtp.inc): failed to open stream: No such file or directory in /home/www/includes/smtp.inc on line 3.
warning: main(): Failed opening 'includes/class.smtp.inc' for inclusion (include_path='.:/usr/local/lib/php') in /home/www/includes/smtp.inc on line 3.
Fatal error: Undefined class name 'smtp' in /home/www/includes/smtp.inc on line 26
if someone can solved this PROBLEM
if someone can solved this PROBLEM
Response Edited - Problem Solved
Installed SMTP module and with some minor configuration of our mail server - voila - problem solved.
I installed drupal and I
I installed drupal and I couldn't send emails, I checked with the isp and my hosting provider and everything is fine.
I test the php test expamle script and it was successful too.
I installed SMTP dev version for 5.2 and my problem solved,
any idea what caused default api of drupal mail not working in my website?
Emails not sending - error message from php node
I got this error message when adding the php to a node:
From: postmaster@mysite.co.uk
Fatal error: Call to undefined function user_mail() in /home/fhlinux169/c/mysite.co.uk/user/htdocs/includes/common.inc(1347) : eval()'d code on line 9
Have been going round in circles with this - this is what my host(Streamline) say:
"This issue is occuring because there is a missing fifth parameter in your mail script. This has always been a requirement of mail scripts on our shared hosting platform but recent updates to our Linux servers (from PHP4 to PHP5) has meant that this is now always required."
I have tested the testmail.php and it works and emails arrive.
Will this be fixed if I install the SMTP Module?
added fifth parameter - now works
In file: common.inc
Line: 1937
Changed:
function drupal_mail($mailkey, $to, $subject, $body, $from = NULL, $headers = array()) {
To:
function drupal_mail($mailkey, $to, $subject, $body, $from = "mysite.com", $headers = array()) {
:(
HI Kimster
Could you please let us know how you fixed this?
I have added that additional parameter, but no luck. :(
Ah, Forgot to tell that, We are also using Streamline!!!!
Do you using SMTP Module?
Vinoth
Vinoth - வினோத்
Hi 4vinoth, Sorry for late
Hi 4vinoth,
Sorry for late reply - I missed this one.
Maybe you have already sorted?
The other thing I came up against was maybe the emails are getting caught as spam - try a few different addresess, I believe this can be a problem with new domains.
I don't use SMTP.
NO Luck :(
Thank You for the reply
வினோத்
Vinoth - வினோத்