參考來源:http://forum.opencart.com/viewtopic.php?f=20&t=141563
Adding a note here for anyone that might be using HostGator for hosting.
According to Hostgator, they recently rolled out some updates to PHP. This was at least true of some of the shared servers. The client that had issues was using the Hostgator Business Account which is a shared account. After HG rolled out these updates, we noticed the forms stopped working.
We also couldn’t get any type of good feedback with error reporting turned on. The forms appeared to be working to the front-end user but no emails were being received by my client.
After a lot of investigation and trial and error, we finally discovered the problem. It was two-fold.
The rolling PHP update that HG did to some of the servers broke the path to Sendmail. So when we pulled up PHPINFO, the sendmail path was nothing but…
Code: Select all
-t -i
while it should have been…
Code: Select all
sendmail_path = /usr/sbin/sendmail -t -i;
To get around this issue, we set the path manually in the local php.ini files in the root directory of our site and in the admin directory.
Just add this line to php.ini as long as that is the real path to Sendmail on your machine.
Code: Select all
sendmail_path = /usr/sbin/sendmail -t -i;
That fixed one piece of the puzzle.
The other piece was the way we formatted the email in the Opencart System | Settings | Mail tab.
We were using –[email protected]. (lower case -f)
We changed this to –[email protected]. (uppercase -F)
Both of these fixes were needed to get the email forms working again. So if you’re having trouble with forms on Hostgator, check to make sure the path to Sendmail is correct and don’t forget to use Capital F instead of lower case right before the email address you want to send mail to in the Mail Settings tab.
參考其他方法
Help – OpenCart won’t send emails!
If you have an OpenCart website you need to configure the mail settings so that email notifications are sent to both the customer and administrator.
Recently I had issues with a clean install of OpenCart not sending notification emails and then secondly, when I finally got OpenCart to send emails (using the Mail option) to both admin and customer – my customers emails were going straight to the spam bin.
After hours of searching about on the internet I finally found a solution to both issues and in this article I am going to let you know how to fix both.
Configuration of OpenCart Mail settings
There are two ways you can configure OpenCarts Mail tab. You can use Mail or SMTP. The mail setting is the easiest to set up but NOT the best solution because this simply uses PHP mail to send system emails.
The problem of sending system emails via this method is that your email headers say the email is sent from the website hosting name instead of your actual domain name. This means that your website system emails are NOT verified and will most likely end up in your customers spam bin, especially if your customer is using Gmail or Hotmail.
As an example, if your website is on a Hostgator shared server the mail header would appear to be sent from something like malibu.websitewelcome.com instead of your domain name. The problem is that shared servers include other peoples websites, some of which may have sent spam, thus blacklisting the server IP as being noted for sending spam. This means your website’s OpenCart system emails will go straight to your customers spam bin. The best way to stop your OpenCart emails going to spam is to use SMTP instead of Mail – discussed further down. If you still want to use OpenCart Mail to send notification emails using PHP mail read on.
OpenCart Mail not sending notification emails using Mail Protocol
I had a new installation of OpenCart on website set up to use the Mail option on a shared server but no emails were being sent to either Admin or Customer.
The reason why OpenCart was not sending emails using the Mail option is because host Sendmail path was incorrect. This can be especially true on Hostgator servers. The instructions below explain how to get OpenCart to send email using the Mail tab.
If your website is on a shared server (not listed by Google for sending spam) and you want to use the Mail option you need to do the following to ensure system emails are sent to both Administrator and Customer.
Part 01 – Is your PHP Sendmail path correct on your website server?
Firstly create a file called phpinfo.php in Dreamweaver or Notepad. Copy the following lines into the document:
<?php
phpinfo();
?>
Save and upload the document to your server root directory. Open the file in a browser to view your system PHP information.
Example: http://www.mywebsite.com/phpinfo.php
This will display your systems PHP version and settings.
Next, search the result for the term ‘Sendmail’.
If the Sendmail path says: -t -i your Opencart will NOT be able to send system notification emails using Mail because the path is incorrect. The correct path should be: sendmail_path = /usr/sbin/sendmail -t -i;
To fix the Sendmail path issue you can set the path manually in the local php.ini files in both the:
Root directory (usually (public_html) of our site andin the
Admin directory.
Just add the following line to the php.ini file as long as that is the real path to Sendmail on your server. (If you are not sure ask your hosting company).
sendmail_path = /usr/sbin/sendmail -t -i;
Part 02 – How to configure OpenCart Mail tab
Next you need to configure the Mail tab in openCart. Login to your OpenCart website and go to System / Settings / Mail.
For the Mail Parameters field you need to enter your Admin email with a prefix of -F. It’s important that the prefix uses uppercase.
Example: –[email protected]
Doing the above allows OpenCart Mail to start sending system notification emails to both Customers and Admin. If your websites shared server has NOT been noted for sending spam the above Mail configuration should work fine for you.
But, if your websites shared server has been noted for sending spam in the past your OpenCart notification emails will go straight to customers spam bins which not good.
Here’s the solution.
Help – My OpenCart emails are going straight to spam! Use SMTP instead of Mail to stop emails going to spam.
If your OpenCart notification emails are going straight to customers spam bins you need to use SMTP instead of Mail. In fact, after researching the differences between Mail & SMTP I’d recommend to use SMTP for all website system emails every time. This is because SMTP mail is sent and verified using a real email address rather than your websites PHP Sendmail which is often used by spammers.
To stop OpenCart notification emails going straight to spam you need to create an SPF Record and use SMTP instead of Mail.
Part 01 – Creating an SPF record
The problem using Mail is that it simply uses the PHP mail function on your website. Any website PHP mail can send mail for any sender email address which means spammers can pretend to be sending mail from sites that don’t belong to them. When this happens the server those sites are hosted on can be blacklisted for sending spam. If your site happens to be on such a host your OpenCart system emails will go straight to spam even though you have never sent any spam yourself.
The only way to fix this issue is by creating an SPF (Sender Framework Policy) record in your DNS settings. An SPF record verifies that mail sent is authentic and won’t be flagged as spam in a recipients inbox.
To create an SPF record you will need access to the domain DNS settings.
Create a new TXT record to verify which sources are legitimately allowed to originate email for your domain names.
To generate your SPF TXT record visit SPFWizard.com
If you are using Google Apps to send your website emails you can get the Google SPF settings here:
https://support.google.com/a/answer/178723?hl=en
Once you have your SPF information you need to add this as a new TXT record to your domains DNS.
You may also need to ensure your that Email Authentication SPF is enabled in your Cpanel.
Note: If your websites DNS settings are managed by your domain registrar ask them to help you set an SPF record for you.
Part 02 – Configuring OpenCart SMTP Mail settings to send mail
Once you have your SPF Record in place you are ready to configure your OpenCart Mail SMTP settings. SMTP uses a real email address (no aliases) to send emails rather than using OpenCarts PHP mail Sendmail.
Using SMTP to send mail in conjunction with an SPF record will ensure your OpenCart website emails are verified, sent and do not end up in customers spam bins.
Login to your OpenCart website.
Go to and go to System / Settings / Mail.
You can obtain the correct SMTP settings for your email account from your sites Cpanel / Email Accounts / Configure Mail Client. Use recommended the SSL/TLS settings.
If you are using Google Apps MX Records for your SMTP mail apply following settings.
Mail Protocol: SMTP.
Mail Parameters: Leave blank.
SMTP Hostname: ssl://smtp.gmail.com
SMTP Username: Your Google App email address. Example: [email protected]
SMTP Password: The password for your email account.
SMTP Port: 465
SMTP Timeout: 5
Add any additional alert emails in the bottom text area separated by commas. Click the image below to see a larger view.
Make a test purchase using another Gmail account. Your OpenCart website will now send your customer notification emails and they should also land directly in their inbox instead of the spam bins.
Less Secure Apps
If you are using Google Apps for your sites email notifications you will need to enable Less Secure Apps under your Google Apps account. If don’t enable Less secure in your Google Apps Panel people who try to register at your website will see a warning that says something like:
Notice: Error: Password not accepted from server! in /home/yourwebsite/public_html/system/library/mail.php on line 289
To enable Less Secure Apps for your website do the following.
Login to your Google Apps Cpanel.
Go to Security / Basic Setting / Less Secure Apps
Go to settings for less secure apps
Enable and save changes.
Open up a new browser tab and search ‘less secure apps google’ or go to the following URL.
https://support.google.com/accounts/ans … 0255?hl=en
Click the link in step 2. “Less secure apps” section of MyAccount.
Ensure Access for less secure apps is Turned On.
Open a new private window and go to gmail.com
Sign in
Search for less secure apps google or go to the following URL.
https://support.google.com/accounts/ans … 0255?hl=en
Ensure Access for less secure apps is Turned On.
Search unlockcaptcha google apps
Click Continue button
You should then see:
Account access enabled
Please try signing in to your Google account again from your new device or application.
Once you have done the above new customers can register without seeing any error messages.
Phew! heh
Summary
To ensure that your OpenCart website notification emails are sent and delivered to customers inboxes you must:
Use the SMTP method with a real email address.
Create a SPF record that states which machines can send mail for your domain.
Reference:
http://www.pixelfire.com.au/website-des … -correctly
http://forum.opencart.com/viewtopic.php?f=20&t=141563
http://www.yabbse.org/community/index.php?topic=3127.0
https://www.youtube.com/watch?v=AFlXF6gPQGU
http://spfwizard.com/
https://medium.com/@BENJITHREESTACK/how … .begy3fz76
https://www.jvfconsulting.com/blog/php- … -delivery/
Views: 71