After completing the checkout process without error I get to cart/checkout/complete and get the error "Unable to send e-mail. Please contact the site administrator if the problem persists." However, the user account I am using as a test customer receives the "Your Order..." confirmation email. So what email is the error referring to? I would also add that the order confirmation email is delayed by a few minutes, while other drupal emails appear right away.
I had the same issue the first time I placed an order using 2.x rc2. I don't think it happened again after that as I believe I created another user and tested it again and it didn't happen.
What version are you using 2.x rc1, rc2, rc3?
I haven't tried the new rc3 yet but may have been fixed?
I am experiencing the same confusing message, although the email gets sent.
There is also a message in reports/ recent log entries:
ca 05/18/2009 - 03:53 Attempt to e-mail invoice for order 5 to failed. Anonymous
In my case it isn't just the first time checkout is finished, but everytime. I am using Ubercart 6.x-2.0-rc3 . This is my first ubercart install so I do not know if it occurs in earlier versions.
Other mails (e.g. from E-cards) sent from the same Drupal install do not exhibit this behaviour.
What email program are you using smtp or php? I had used the smtp version and had many problems. After switching to PHP mail I have had no problems.
To be honest I dont know if I'm using php or smtp. I don't even what exactly you mean with that. Where is the setting for it so I can check it and report back?
But whichever I am using, it is working (without generating errors) for other drupal modules. It even works with the ubercart checkout page. It just generated an error, although the mail is sent.
Under admin/build/modules mail you should have the option of picking PHP Mailer or SMTP Authentication Support
I dont't have the choice between php mailer of smtp authentication support.
I do however have mime mail enabled:
Mime Mail 6.x-1.x-dev
Mime Mail CSS Compressor 6.x-1.x-dev
Apparantly there are some issues using these two together (mimemail and ubercart checkout):
http://drupal.org/node/336408
I will try to fix this and report back (for future referents).
Thank you for helping me look in the right direction. Any further pointers /questiosn are of course welcomed.
I found the answer and am almost to embarassed to report back 
Looking around the apache error log I noticed:
sendmail: fatal: www-data(33): No recipient addresses found in message header
Which struck me ad strange as the mail to the customer is being sent. However the mail to the store administrator wasn't! And sure enough in the store settings I had neglected to set an emailaddress ( /admin/store/settings/store/edit/contact )
Hope this helps someone as dimwitted as me 
you certainly helped this dimwit - I had the exact same problem!
Just talking about this in IRC - seems silly that you can have that setting (in /admin/store/settings/store/edit/contact) empty at all. How comes this doesn't default to the site admin email? Or why doesn't Ubercart warn you about that like it does Images in the main store admin (/admin/store)? Seems it'd be an easy fix.
I think the problem in my case was exactly that. I -incorrectly- assumed ubercart would just use the site admin email address. I'm glad it is possible to set a different emailaddress though.
Just goes to show assumption is indeed the mother of all f$#ck-ups 
To be honest, given the code I'd expect it to work whether or not that e-mail was set:
<?php
// Returns the e-mail from string in the format of Store Name <store@email.com>.
function uc_store_email_from() {
$email_from = variable_get('uc_store_email', '');
if (empty($email_from)) {
$email_from = variable_get('site_mail', ini_get('sendmail_from'));
}
// Add the store name to the e-mail from line. Must be optional to prevent
// server conflicts.
if (variable_get('uc_store_email_include_name', TRUE)) {
$store = variable_get('uc_store_name', '');
if (!empty($store)) {
$email_from = '"'. $store .'" <'. $email_from .'>';
}
}
return
$email_from;
}
?>I can duplicate the problem. It's just a UC install on which I never set up the Store Settings.
The following gets logged to watchdog by 'mail', note the message - the recipient address appears to be missing, not the sending address. The recipient in this case is the store owner, as the customer does indeed get the email.
Type mail
Date Friday, May 29, 2009 - 13:40
User admin
Location Referrer">http://blb/drupal/cart/checkout/complete
Referrer Message">http://blb/drupal/cart/checkout/review
Message Error sending e-mail (from ryan@xxxxx.org to ).
Severity error
Hostname ::1
Operations I'm pretty sure the problem is in the "uc_checkout_admin_notification" predicate in uc_cart.ca.inc:
(line 102-109):
'#settings' => array(
'from' => uc_store_email_from(),
'addresses' => variable_get('uc_store_email', ''),
'subject' => t('New Order at [store-name]'),
'template' => 'admin',
'view' => 'admin-mail',
'format' => 1,
),'addresses' should probably be uc_store_email_from() rather than variable_get('uc_store_email'
Ryan
Well I think you could still use variable_get, but instead of '' being the value to insert if that var doesn't exist, it should just use the default Drupal email address. (Either that or, again, a warning in the Store Admin dashboard to ask you to configure those settings seems fairly logical.)
Just want to say thank you for this post. It takes me a while to fix this problem.
wow! been wondering why did i got those errors then here you are guys! thanks this saves me alot of time!
I just installed RC6 (from RC5), and in doing some testing I am getting 3 "Unable to send email" error messages when I do an anonymous checkout. No emails get sent (in contrast to what others have experienced in this forum.
The log is littered with mail errors such as the following:
Error sending e-mail (from "Developmental Science" <merchant@devscilabs.com> to testuser@eduviews.com).
Does anyone have any further ideas? I do have a Store email address set. To my knowledge, I haven't been getting any email errors up until I did the upgrade.
It turns out that my ISP must have recently broken PHP sendmail (as pointed out in another forum thread that escapes me at the moment). I can't send email from the Drupal contact form or any other Drupal module.
As a short term fix (I expect the ISP to fix the sendmail problem), I installed the SMTP module and now route mail using SMTP.
After scouring the web, issue queues, and the code, I tried turning off the auto-login feature for anonymous users and *then* emails got sent. Prior to that, emails were only sent if the user was logged in. In looking at the code, I think I may know how to fix it though I'm not sure where I'm supposed to send a patch.
But, I still am getting the "unable to send" message since somewhere in the system it's trying to send an email to "" (blank) though, for the life of me, I can't figure out where this is happening. I'm using smtp and not sure if that is part of the puzzle or not.
Kristen
I'm getting this message. error reporting says:
Error sending e-mail (from "client name" <customerservice@client.com> to <p>user@hotmail.com</p>). This is right after a user creates an order.
For some reason the email address is being wrapped in tags. I'm not sure what's causing this. There's no rich text editor for entering an email address....
Digging deaper.
Edit: It was actually a â„¢ symbol in the Store Name that was throwing the erorr. I checked the box that removed "store name" from the mail and all was fine.
Not sure if this is helpful or not..
We have been testing Drupal deployments on a few different servers and have found something wrong with the mail() function in php 5.10 through 5.12
All drupal sites we installed had the same non functioning error. Server didn't matter. we tied FreeBSD and Linux. Although we did not try any win flavor..
started documenting it here: http://www.unixug.com/weBlog/content/problem-email
Ren
I had this problem when the email addresses where being formatted by fckeditor to include tags around the email address.
I also get the "Unable to send email" message on the Order Complete page, however, in my case the message is intermittent and the user DOES NOT get the email. Instead an email about the error is sent to the site's admin email address which is the address assigned to the store. For the few orders that this error occurs on, when I open the order to look at the status, there is the "Customer info" block with a field labeled "Primary email" and the value of that field is blank. For the majority of orders where the "Unable to send email" message is not displayed, the "Primary email" field correctly holds the email address of the user that placed the order AND the email goes through to the user.
I'm using Drupal 6.16 and Uber 2.2
Has anyone had this error under these conditions?
I'm seeing similar things on our site right now.
Right now we have anon check-out turned off, so my current line of investigation follows the path of seeing where the email gets picked up. Thinking that maybe it's grabbing the email address of the anon user (blank) before they login or something like that.
We're having the same issue on our end. I have a dev environment set up, and everything works there. On live, with the same settings, I get the error. I've got store information all set with a valid email, though it's an alias, and that should work as it does on my dev site.
Users all get their mail, and the admin gets one, but we also get a failed to send error in the log, with a blank "to" address..
Just curious if there's been any progress as the aforementioned tips didn't work out so well for me.
I had the same issue. I tracked it down to the CA code of affected modules, for example uc_order and uc_roles.
The problem lies in these lines of code, which is present in quite a few core ubercart modules.
<?php
foreach (explode("\n", $addresses) as $address) {
$recipients[] = trim($address);
}
?>The explode() manages to create an empty element in the resulting array, so $recipients get filled with valid e-mails PLUS an empty string at the end.
I tried looking for a trailing comma or new line character in all the textarea/textfields in the admin pages I could think of that would affect this, but I couldn't find any.
So my solution was to be defensive in the call to drupal_mail() later on, checking for empty($email) before calling drupal_mail() on line 1161 in uc_order.ca.inc and all other modules which use the above lines.
I attached a patch of uc_order.ca.inc which removed the warnings for me.
I don't know if this is a PHP setting issue or not, or if this even is the correct place to fix it. The $addresses variable should maybe be trim()'ed or validated before getting here, I don't know...
But at least this is a work-around for those less skilled with programming and debugging.
Hope it helps someone.
EDIT: Forgot to mention I created the patch against Ubercart-6.x-2.2
| Attachment | Size |
|---|---|
| uc_order.ca_.inc_.patch | 1.93 KB |
If this is a fix, then what am I supposed to do with the attached patch you have there? Kind of a noobie...
You have to apply the patch against the file "uc_order.ca.inc". You can find that file in /sites/all/modules/ubercart/uc_order/uc_order.ca.inc
See http://drupal.org/patch/apply for detailed information on how to apply a patch.
Good luck.
Same problem on Ubercart-6.x-2.4. I've just applied your patch (manually). I thought I could play with ckeditor to clean up the addresses, but haven't found the culprit there yet.
Thanks, your patch did help me!
Thank you very much for the patch. Would be very cool if the Ubercart people incorporate it.
I just started seeing the email sending problem when a new user completed checkout.
The problem surfaced for me just after turning off "Require e-mail verification when a visitor creates an account" because a user who had an invalid credit card number failed to have his new account properly created on checkout.
Thanks again for providing this extremely helpful patch to Ubercart.
Is this patch in the issue queue on Drupal.org? It should go there, so longwave or someone can apply it to the dev version of UC. http://drupal.org/project/issues/ubercart
I had the same problem as first described. Checked out daveydo's solution as I use ckeditor. Sure enough ckeditor was being used under conditional actions. It was adding extra formatting to recipient email addresses under Actions for predicates with a notification class.
Fixed the problem by going to ckeditor global profile (admin/settings/ckeditor/editg) and under Visibility settings I added admin/store/ca/* to the list of Fields to exclude.
I have since tried a couple of dummy orders under the same user as I was getting the errors before. All good!!
No more errors.
I hope this helps.
Cheers
Bill
NB: After making the above change I had to go into each notification predicate and get rid of the extra formatting around the recipient email address under Actions and then Save changes.
I just solved this issue and also this one by :
1. disabling CKEditor.
2. resetting all the predicates which have the reset link available at admin/store/ca.
Now everything is working properly.
Fixed the problem by going to ckeditor global profile (admin/settings/ckeditor/editg) and under Visibility settings I added admin/store/ca/* to the list of Fields to exclude.
NB: After making the above change I had to go into each notification predicate and get rid of the extra formatting around the recipient email address under Actions and then Save changes.
After being up until 4am yesterday and the prospect of the same today trying to work out what had led to this problem your solution worked for me, too!
Many thanks Bill, due to your solution our shop can now participate in the xmas "rush"!!
Barry
Übercart at: www.montessori-material.cz/a/
I also experienced this problem in ubercart.
In my case, it turned out that i had an extra blank line in the e-mail recipients field of a conditional action.
That certainly seems like a bug to me, should be smarter than that.
I also experienced this problem in ubercart.
In my case, it turned out that i had an extra blank line in the e-mail recipients field of a conditional action.
That certainly seems like a bug to me, should be smarter than that.
Thank you so much! That red "Unable to send e-mail" bar was starting to get on my last nerve.
I desperately need to find a fix for this error "Unable to send e-mail"
it send an order fine to me admin, however the customers are not getting their invoices and this is becoming a huge problem! I have scoured this forum for a real solution and have not been able to find anything that works. I have a tried everything. My settings and triggers are setup correctly, and nothing seems to be working!
What have you done? I have got the same problem - e-mail to e.shop owner is being sent correctly, however, customers are not getting their order confirmation e-mails... I am not using any wysiwyg editor.
I am wondering if everyone having this problem is a user of the Automated Logout (autologout) module?
I'd been having this problem also.
The store name had a period at the end of it "ABC Dist.", I removed the period and emails are now being sent as usual. Hope that helps someone.
I'd been having this problem also.
The store name had a period at the end of it "ABC Dist.", I removed the period and emails are now being sent as usual. Hope that helps someone.
i posted a solution for this issue at http://drupal.org/node/455888#comment-4674252 check if this solves your problem as well.
------------------------------------------------------------
http://www.drupalfx.com
For people hitting this via Google, there is another, completely different possible cause for this problem: The selinux default configuration prevents apache from sending e-mail via sendmail. Selinux is enabled by default on Fedora.
This is apparent from the following log message in /var/log/maillog: sendmail[2640]: NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
The solution is dead easy. Just enter the following command: setsebool -P httpd_can_sendmail 1


