Host solution for emails needs php code
Host solution for emails needs php code
Script URL:
Version of script: 1.9.0
Hosting company: one.com
URL of phpinfo.php:
URL of session_test.php: https://tanbur.co.uk/gbook/gbook.php
What terms did you try when SEARCHING for a solution: have searched many with email problems
Write your message below:
I am not receiving email notifications. The php settings script has my email correct. So I contacted the hosting company today through their chat. I've been given a line of
"......this PHP mail() code should work:
https://one-docs.com/tools/pastebin/NlVP3ite
Of course, setting a domain-specific address with the default placeholder."
So I had a go at putting this into settings,php; but still no emails. I guess my coding skills are not up to the task, so any advice would be appreciated.
And I'll have another go using that from their pastebin.
Version of script: 1.9.0
Hosting company: one.com
URL of phpinfo.php:
URL of session_test.php: https://tanbur.co.uk/gbook/gbook.php
What terms did you try when SEARCHING for a solution: have searched many with email problems
Write your message below:
I am not receiving email notifications. The php settings script has my email correct. So I contacted the hosting company today through their chat. I've been given a line of
"......this PHP mail() code should work:
https://one-docs.com/tools/pastebin/NlVP3ite
Of course, setting a domain-specific address with the default placeholder."
So I had a go at putting this into settings,php; but still no emails. I guess my coding skills are not up to the task, so any advice would be appreciated.
And I'll have another go using that from their pastebin.
Last edited by redbush on Mon Jan 30, 2023 8:46 pm, edited 2 times in total.
Re: Host solution for emails needs php code
Not sure if the person on the chat understood what you were trying to say as having "https" in the PHP mail() code doesn't really make sense.
Try this:
1. copy this code:
2. change you@exmaple.com to your email address
3. save it as "email-test.php"
4. upload to your server
5. run email-test.php in your browser
Do you receive the test email?
If no, check with your host why this simple PHP mail code does not work on their server.
Try this:
1. copy this code:
Code: Select all
<?php
error_reporting(E_ALL);
mail('you@example.com', 'Test', 'Test message');
echo 'Email sent';
?>
3. save it as "email-test.php"
4. upload to your server
5. run email-test.php in your browser
Do you receive the test email?
If no, check with your host why this simple PHP mail code does not work on their server.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Host solution for emails needs php code
Many thanks for getting back to me.
The email-test.php page view said 'email sent' but the email did not arrive.
So the chat person at one.com said I need to check as follows:
"Please note that the "To" or "From" address must be an active email account on your domain with one.com..... To ensure that your contact form is properly setup, please follow this guide:
https://help.one.com/hc/en-us/articles/115005594345-Can-I-send-emails-from-my-website-
...."
I have 2 active email accounts on the domain, but neither received anything when tested.
The above link takes me to
https://www.php.net/manual/en/function.mail.php
so I'll have another read there.
The email-test.php page view said 'email sent' but the email did not arrive.
So the chat person at one.com said I need to check as follows:
"Please note that the "To" or "From" address must be an active email account on your domain with one.com..... To ensure that your contact form is properly setup, please follow this guide:
https://help.one.com/hc/en-us/articles/115005594345-Can-I-send-emails-from-my-website-
...."
I have 2 active email accounts on the domain, but neither received anything when tested.
The above link takes me to
https://www.php.net/manual/en/function.mail.php
so I'll have another read there.
Re: Host solution for emails needs php code
I'm not familiar with one.com but getting that sample email script I gave you is something they need to help you with.
Once that works, we can get GBook to send emails too.
Once that works, we can get GBook to send emails too.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Host solution for emails needs php code
One.com are looking into the coding of test email and will get back to me.
Re: Host solution for emails needs php code
Response from host was not successful. While waiting for their second response, I've found a solution. Yay!!!
<?php
$to_email = 'someone@yahoo.co.uk';
$subject = 'Testing PHP Mail';
$message = 'This mail is sent using the PHP mail function';
$headers = 'From: someone@hostserver.co.uk';
$from_email = 'someone@hostserver.co.uk';
mail($to_email,$subject,$message,$headers,$from_email);
?>
Mail was received!!!
<?php
$to_email = 'someone@yahoo.co.uk';
$subject = 'Testing PHP Mail';
$message = 'This mail is sent using the PHP mail function';
$headers = 'From: someone@hostserver.co.uk';
$from_email = 'someone@hostserver.co.uk';
mail($to_email,$subject,$message,$headers,$from_email);
?>
Mail was received!!!
Re: Host solution for emails needs php code
Great.
Now you can edit your gbook.php to do something similar.
Find this code twice in gbook.php:
Change it to something like (I didn't test):
Now you can edit your gbook.php to do something similar.
Find this code twice in gbook.php:
Code: Select all
mail($settings['admin_email'],$lang['t41'],$message,"Content-type: text/plain; charset=".$lang['enc']);
Code: Select all
mail($settings['admin_email'],$lang['t41'],$message,"From: someone@hostserver.co.uk\nContent-type: text/plain; charset=".$lang['enc']);
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Host solution for emails needs php code
Thanks for amended code.
Your 2022 version is not sending, but I can't find the fault.
However, I found an intact guestbook from 2009, version 1.7.0. The message title is received but the comment is blank.
Your 2022 version is not sending, but I can't find the fault.
However, I found an intact guestbook from 2009, version 1.7.0. The message title is received but the comment is blank.
Re: Host solution for emails needs php code
Something weird happens with the host server. The 2022/23 version that failed to send any messages from guestbook now also fails to send the test email that was successful yesterday. If I go the file, make a small edit it sends. So I'll check with host about this anomaly.
Re: Host solution for emails needs php code
Same thing with 2023 gbook. Edit and save. It then sends.
Re: Host solution for emails needs php code
Not sure what is going on exactly, but as long as it sends you're good to go 

Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Re: Host solution for emails needs php code
Everything is working well! I've edited the guestbook to create 'comment boxes' for most pages of Tanbur Music Education Links. Here are a couple of examples: http://tanbur.co.uk/banyan.html
http://tanbur.co.uk/hatdance.html
http://tanbur.co.uk/hatdance.html