Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
I am having problems with email sent from my web sites 'Contact' page. Sometimes (about 10-20% of the time) the email goes through, but most of the time it does not. When the form is correctly filled out and the "Send' button is clicked, there is always a message saying the email was successfully sent.
Here's the setup:
Web site: www.collinsnet.us hosted by BlueHost
Site and Vendor emails: doug@collinsnet.us
Mail setup type: Mail
My email (doug@collinsnet.us) is hosted by Rackspace. It is a Microsoft Exchange email account. I also have the same email setup in the BlueHost cPanel, but it is not my active email.
I have spoken with both Rackspace and BlueHost tech support. Rackspace support said that when an email shows up in their log for my account from username@box####.BlueHost.com, that it is always successfully sent through to me. Apparently only 10-20% of the sent emails make it to the Rackspace server.
The response I received from BlueHost tech support is this:
'The issue you see is because our servers require you (or your script) to use a properly formatted, valid From: field in the email's header. If the From: field is not formatted correctly, empty or the email address does not exist in the cPanel, the From: address will be changed to username@box###.BlueHost.com.
You may refer following link for more information: https://my.bluehost.com/hosting/help/206 '
I have gone to the .../help/206 link, but I have no idea how to check and/or do what they suggest.
Any ideas on how I can resolve this problem?
Thank you,
Doug
Offline
Hi Doug, with Bluehost you'll want to configure that email address in your control panel. I don't have access to my Bluehost control panel right now to give specific advice. In general, find the email settings and add the account "doug@collinsnet.us"
This doesn't mean that Bluehost will be hosting your email - you would need to perform other settings changes for that to happen. Rather, this sets up the account in Bluehost so that Bluehost is aware of it and considers it to be a legitimate sender address for emails sent from their servers.
That should solve the problem. You should receive emails more reliably and also find that the from address is your own address rather than the username@box####.BlueHost.com email address.
Offline
Ben,
Thanks for the quick response. I did already have my email in the 'Current Email Accounts', although not actively hosted on Bluehost. After reading your suggestions, I went back in and the only thing I can change in the setup is the password. So, I "changed" the password (I actually just re-entered my current password in each of the two fields and clicked 'change password'). Still no emails coming through. :-(
Doug
Offline
Hi Doug, I've found too that my Bluehost is no longer sending emails, despite being configured as I had advised. It had been reliably doing so. I'll talk to their tech support tonight.
Offline
Thank you!
Offline
Hi Doug, I've had a good look at the code and a long support chat with Bluehost.
There are two things at play here, both of which need fixing for emails to be sent out properly from Bluehost:
1. Our code uses an empty From name. To be consistent with other emails, this should instead use the Company Name setting The empty From name that we try to send from means that the email header looks like:
From: "" <you@yourcompany.com>
where the "" means an empty name. While this isn't ideal, it's not an error. However, Bluehost requires the field to either look like:
From: "some name" <you@yourcompany.com>
or
From: you@yourcompany.com
So this requires a fix in our code. I have that fix in place. We just need to decide how best to provide it.
2. Bluehost will no longer set the From address correctly without an obscure work-around on your site. I argued that this is not something we should need to do, but the support didn't agree. The fix is to set a value for the sendmail_path setting in your site's php.ini that looks like this:
sendmail_path = /usr/sbin/sendmail -t -i -f'you@yourcompany.com'
(substituting you@yourcompany.com with your actual address.)
You should be able to find the php.ini file to edit via FTP at the top of your site. You may find that the second fix alone helps emails get through.
Bluehost has a support document on these items here: https://my.bluehost.com/hosting/help/206
Offline
Ben,
Thanks so much for researching this problem.
I cannot find a php.ini file in my site. I did a search with FileZilla of the entire public_html directory on my site and nothing was found. Next I created a php.ini file with Notepad++ and placed it in my public_html directory. The 'Contact' email still does not work. Here are some specific questions:
Did I put the php.ini file in the correct place on my site?
My php.ini file is a simple text file (created with Notepad++) with just the code you specified and 'you@yourcompany.com' changed to 'doug@collinsnet.us'. Is it necessary to enclose this code in some "hooks" in order for it to be activated?
I am not using PHPlugins in my site. Do I need to activate PHPlugins in my template(s) in order for php.ini to work?
I apologize for these novice questions, but I am a novice at this!
Of course, this is only half of the solution you described. Will it take the next update of Backlight to obtain the other part of the fix?
Once again, thanks for your work on this.
Doug
Offline
you may need to create a php.ini file via your host's C-Panel. That's what I initially had to do a couple years or so ago when I needed to increase allowable upload sizes.
look for something like "php config"
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Hi Doug, I found a single php.ini file on my site. The PHP Config setting I'm using is PHP 5.4 (single php.ini).
It was a matter of finding the sendmail entry, changing the value and removing the leading semi-colon to make the setting active.
To verify that the setting has been applied, log into Backlight, and click on PHP Info under Special Links, then on that page search for sendmail_path and look at the value.
I've updated the Backlight zip file on the store with the other fix. This is only a change to backlight/admin/application/delegates/ContactDelegate.php.
We'll likely have a blog post outlining this and other minor fixes for 1.1.
Offline
Rod and Ben,
I followed your suggestions for creating a php.ini file through the Bluehost cPanel. The file that was created was automatically placed in my public_html directory. I found the following section and added my email as indicated in the sendmail_path line:
Start of copied section:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i -f'doug@collinsnet.us'
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
End of copied section
Following this change, I have successfully sent emails from the Contact page of my web site. Time, and further testing, will tell if this change has made the Contact email function robust.
There are a number of other functions called in the php.ini file as it was installed through the cPanel. I hope none conflict with my web site. As far I can tell so far (limited testing!) there are no conflicts and all is well.
I also made these two changes in the php.ini file:
max_file_uploads = 500 (from 20 - sometimes one of my albums contain several hundred photos)
date.timezone = "America/Seattle" (from "America/Denver", since I am in the US Pacific Time Zone)
I hope that I have correctly understood the purpose of these instructions and changed them correctly.
Thanks again to both of you for all of your help.
Doug
Offline
Hi Doug, I'm glad that looks to have solved it for you.
I'd expect the settings in php.ini to mirror the hosts defaults, so if you left it unchanged then there should be no change to how your site operates.
max_file_uploads affects the files attached to form submissions. Backlight only attempts to upload one file at a time, so increasing this above 20 shouldn't have any affect. You should not need to change any server settings to cater to large galleries.
Offline
Ben,
Thanks for the info on php.ini changes, etc. That puts my mind at ease!
In addition to the php.ini changes, I downloaded the Backlight file you updated and put the new ContactDelegate.php file on my collinsnet.us site but not on my thewilderness.us site (a subdomain in my collinsnet.us site).
Next I performed an experiment. I sent emails from the Contact page on both of my sites (collinsnet.us and thewilderness.us (the subdomain site)). I sent these emails from five different browsers (Edge, Opera, Firefox, Chrome, and IE). I did this about 90 minutes ago and only 4 of the 10 emails have come through (one from collinsnet/Firefox, one from thewilderness/IE, and both from Chrome). So there still seems to be a problem.
Here's what I found on the Backlight PHP Info pages (it is the same for both collinsnet.us and thewilderness.us):
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i -fdoug@collinsnet.us /usr/sbin/sendmail -t -i -fdoug@collinsnet.us
Does this look correct to you?
Any further ideas as to what is going wrong?
Doug
Offline
Ben,
I repeated my experiment with all five browsers. Chrome, Firefox, and IE all worked for both of my web sites. Opera and Edge did not, again, work with either web site. I have Opera configured with the VPN option. It may be that the problem is with Edge and Opera with VPN.
So, it may be that the problem is solved for the most commonly used browsers.
Doug
Offline
Hi Doug, these changes are all server-side. The browser should have no part to play in emails being received or not. Can you provide me with a Backlight admin login for both domains so that I can review the settings?
Offline
Ben,
Its in your email.
Thanks,
Doug
Offline
This is not apparently an isolated problem. My site is not frequently visited and I had not noticed the Contact page had stopped working. I also use Bluehost and with the above fixes, I am able to get one in 10 to go through.
My email is hosted by Google rather than Rackspace as above. Hosting doesn't seem to make a difference.
1. Created php.ini via the Bluehost cPanel and modified:
sendmail_path = /usr/sbin/sendmail -t -i -f'jim@jamesherman.net' in Unix only
After multiple failed messages and based upon Ben's discussion with Bluehost support also added:
sendmail_from = jim@jamesherman.net in Win32 only
View PHP Info:
sendmail_from jim@jamesherman.net
sendmail_path /usr/sbin/sendmail -t -i -fjim@jamesherman.net
2. Re-downloaded and updated ContactDelegate.php
If you need guest access to my site as well, let me know.
JIm.
Last edited by jherman (2016-11-13 21:21:13)
User with too little time but coding is therapeutic.
Offline
Hi Jim, to be honest, Bluehost's handling of outgoing emails has become quite a pain. I too am using Google for my email and, until recently, this was working perfectly with Bluehost without the need to alter or create php.ini files.
Can you email me a Backlight admin login, so that I can check the PHP settings?
Something else to check: On your control panel, have a look at the PHP Config setting. If this is not set to an option with (single php.ini) can you try changing it to one of those options, e.g. PHP 5.4 (single php.ini)? After doing so, you may find a new and complete php.ini has been added to your public_html directory, with the one you had previously created renamed. If so, edit the sendmail_path line in the new php.ini, making sure to remove the leading semi-colon if there is one.
There are many 'if thens' in the above. Can you let us know how that goes?
Offline
A few!
I was using 5.4 fastCGI but changed to single. It rewrites both the php.ini and the .htaccess files. In the latter only the first 2 lines are changed to reflect the current php configuration. Updated php.ini to match my note above.
Worked for 3 successive emails then stopped. Also started getting a red box on Backlight and my pages:
Something went wrong
Unexpected error: Module 'ionCube Loader' already loaded in Unknown on line 0
Please report error at http://community.theturninggate.net
I changed back to fastCGI and all the errors went away. For grins I tried disabling php.ini and the .htaccess lines. Leaving only your new ContactDelegate.php file as the only change. Nope.
Currently, fastCGI and php.ini settings as above.
Guest admin OTW.
JIm.
Last edited by jherman (2016-11-14 00:50:26)
User with too little time but coding is therapeutic.
Offline
Hi Jim, that sounds promising on the emails. There are two ways to fix that 'Module' error.
1. Go into PHP Config, and again set to a single php.ini option. Uncheck all of the available optional modules. Backlight doesn't require any of them. or:
2. Contact Bluehost's support and inform them that you are getting messages such as the above, and request that they 'fix your file permissions' to solve this. I do not know exactly what that entails, and apparently it's something that only their support can do.
Offline
Fixed the php error without problem and now using single.
Tried 2 iterations with the first then both variables set. No email getting through.
sendmail_path = /usr/sbin/sendmail -t -i -f'jim@jamesherman.net' in Unix only
sendmail_from = jim@jamesherman.net in Win32 only
This should be only a server issue but cleared the template cache and tried sending on Chrome, IE, Edge and FireFox making sure the site and pages were reloaded from the server. None went through.
User with too little time but coding is therapeutic.
Offline
Hi Jim, this is proving to be difficult to solve. Can you provide me with an FTP login so that I can run an email test script from your site?
Also, have you registered your email address in your Bluehost Control Panel? That is also needed for emails to be sent out properly.
Offline
Putting it mildly. My cPanel indicates I have an email registered but when I check my email registration in cPanel it indicates none registered. I have apparently set up a registered email some years ago and have been unable to find it to confirm the address is the same. No email getting through this morning and I added my email, tested, then a forwarding rule, tested.
I also made sure I haven't broken my Google account on my domain.
FTP OTW.
JIm.
User with too little time but coding is therapeutic.
Offline
Long story short, Bluehost has apparently updated security for emails and forms to decrease risk of bot action. Ben and others have been busy sorting this out and this morning in the Newsletter, Ben has put together a document whit discusses the issues and how to fix them.
http://backlight.theturninggate.net/doc … n_bluehost
Jim.
Last edited by jherman (2016-11-16 20:39:54)
User with too little time but coding is therapeutic.
Offline
Ben,
Thank you so much for figuring this out and solving this problem. For others following this thread in hopes of a solution, I think the link Jim provides above (also in Matt's latest newsletter) provides most if not all of what you need to solve your Contact email problem.
However, Ben also had me do this (it was necessary for me to also do this to ultimately solve the problem):
I will quote what Ben suggested I do:
"It may be worth removing the IP Address from the contents of the contact email to see whether that makes a difference. To do this, edit backlight/admin/application/delegates/ContactDelegate.php and comment out lines 82 and 83 so that they look like:
//$htmlMessage .= '<br/><p><strong>Sender IP Address:</strong> '.$_SERVER['REMOTE_ADDR'].'</p>';
//$plainMessage .= 'Sender IP Address: '.$_SERVER['REMOTE_ADDR']."\n";
This change may have been silently applied to the Backlight 1.1 download. If so, you can re-download Backlight 1.1 and just replace this one file. Any comment on that, Ben?
Special thanks to Ben for once again demonstrating that The Turning Gate and this Forum provide the best support on the web!
Doug
Offline
This change may have been silently applied to the Backlight 1.1 download. If so, you can re-download Backlight 1.1 and just replace this one file.
It looks like they have been commented out in the current version
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline