Email Notifications

Hi all,



I took on a site that was custom designed. After updating the design to one from the skins repository, the customer stopped receiving email notification when someone places an order.



I checked admin>orders>order status and for all there is a checkmark next to “notify customer” AND “Notify Orders Department”. So this part is good.



What file(s) do I have to look at to see what I am missing?

Clear the site cache by using ?cc as the URL.

Verify that you have Email setup correctly in Settings/Email

Check your spam bucket for the emails. If you're using PHP Mail then that's probably where they are.

Thanks for your reply. I have already cleared the cache in the past and this problem still was present. Here's what I've done.



When you go to www.domainname.com/mail there is a .htaccess folder. In that folder it shows this:





=====

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mail.domainname.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.mail.domainname.com$

RewriteRule ^/?$ “http://mail.google.com/a/domainname.com/” [R=301,L]

=====

//I have used domainname.com for the real domain of course.



In admin > settings > email the drop down menu is on “Via php mail function” and the SMTP server settings are empty. The path to sendmail program is /usr/sbin/sendmail



In admin > settings > company all the company info is there… here's the email info on that page:

=====



User department email: email@domain.com

Site administrator emmail: same email

Order department e-mail address: same email

Help/support department email: empty

Reply-to-newsletter emial: empty

=====



I looked in the server (root directory as well as skin root directories) and did not find a mail.php file or anything that would have the info that would normally go into the mail.php file.

No idea about any mail.php files nor your use of mail.yourdomain.com

Email is handled by the PHP Mailer class in cs-cart. The function that sends mail is called fn_send_mail() and is located in the core/fn.common.php file.

I read on here [url=“CS-Cart Documentation — CS-Cart 4.15.x documentation”]CS-Cart Documentation — CS-Cart 4.15.x documentation that you should create a mail.php file in the root directory of cs-cart installation.



What is interesting is the emails worked before I changed the design. Soon as I updated the design to a new skin the emails stopped. What files could there possibly be that can do this?



Regarding that file you mentioned… here's what I see.





// Send email

//

function fn_send_mail($to, $from, $subj, $body, $attachments = array(), $lang_code = CART_LANGUAGE, $reply_to = '', $is_html = true)

{

$__from = array();

$__to = array();



fn_init_mailer();

$mailer = & Registry::get('mailer');

$languages = Registry::get('languages');



if (!is_array($from)) {

$__from['email'] = $from;

$__from['name'] = Registry::get('settings.Company.company_name');

} else {

$__from = $from;

}



Registry::get('view_mail')->setLanguage($lang_code);



$mailer->ClearAttachments();

$mailer->From = $__from['email'];

$mailer->FromName = $__from['name'];

if (!empty($reply_to)) {

$mailer->ClearReplyTos();

$mailer->AddReplyTo($reply_to);

}



$mailer->IsHTML($is_html);

$mailer->CharSet = CHARSET;

$mailer->Subject = Registry::get('view_mail')->display($subj, false);

$mailer->Subject = trim($mailer->Subject);

$body = Registry::get('view_mail')->display($body, false);

$mailer->Body = fn_attach_images($body, $mailer);



if (!empty($attachments)) {

foreach ($attachments as $name => $file) {

$mailer->AddAttachment($file, $name);

}

}



if (!is_array($to)) {

$__to = str_replace(';', ',', $to);

$__to = explode(',', $__to);

} else {

$__to = $to;

}



foreach ($__to as $v) {

$mailer->ClearAddresses();

$mailer->AddAddress(trim($v), '');

$result = $mailer->Send();

if (!$result) {

fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_message_not_sent') . ' ' . $mailer->ErrorInfo);

}



fn_set_hook('send_mail', $mailer);

}



return $result;

}

The mail.php file is intended for debugging. This just sends a test message via the PHP Mailer function and has nothing really to do with the cart.



Check your Orders/Order statuses settings and also check your spam buckets. If you're using PHP Mial, that's probably where your messages are.



We sell a cheap addon that will log all outgoing emails sent by cs-cart. You can find it at: Email Logging

While this will do nothing to really solve your problem other than to tell you that the system did send an email and who the to and subject fields are. Once it leaves the cart, there is no real way to track it.

Thanks for the reply. Are there any other files that I should be looking at? for example if the site was using a different skin before and it was working, if I change the skin and now it's not working… is there any particular file that I can compare from the two skins to see what the difference is?

The skin should have nothing to do with it other than if you had customizations in the mail templates. But even if you did, the mail templates would still be there, but without your modifications.



Check the directory:

skins//mail/orders

to see if you have things like invoice.tpl If not, you might want to reinstall your skin.



Many sites have ownership/permissions issues that prevent new skins from being installed and/or other changes by the cart itself. If you run your PHP in DSO mode (runs as user nobody or apache) and your site has files owned by your cpanel login, then the cart will not be able to update/install files. You will have to work with your host to address this since it is usually ownership rather than permissions problems.

Hi again,



Just rain a mail.php and it showed 1 and I did receive an email. So the test worked there.

i looked into the fn.common.php and didn't see anything out of the ordinary… but I did see a “fn_set_hook('send_mail', $mailer);” no quotation marks. Not sure if that has something to do with it.

I double checked the admin > settings > emails and it's on via php mail function



I don't know where else to view to see if any issues are visible.

*UPDATE



I fixed the issue. The issue was not with the mail server, it was a setting. I went to Admin > Content > Pages > Contact Us > Form Builder and changed the “E-mail to” section.



This helped in figuring out where the emails go to when filling out the forms. However, it does not show where the emails are going when someone places an order.



However, I suspect the issue is about spam. When I changed the email to my personal gmail address, the form submittal went straight to spam. That's probably because it came from “Unknown Sender”.



How can I change that to make the emails come from a email address?