Using a PHP Email Script
Posted by Noble M on 27 June 2014 07:33 AM
If you’re facing an issue with the contact form (email script) on your website, its possible that your emails are getting blocked by our servers.
Why does this happen?
Traditionally, most email scripts you find online for contact forms are built with either a customizable or dynamic sender email address (email address filled in while filling the contact form) or do not carry an email address at all. On our shared servers, such email scripts do not function.
Why this restriction?
We’ve enabled this restriction so that our server authenticate the sender (from) email address and prevent users from misusing it to send spoof emails from our servers.
What’s Email Spoofing?
In simple terms, its an email sent to anyone with a forged sender address. These emails are generated using email scripts.
How does it affect a server?
Sending spoof emails from a server results in blacklisting of that server globally.
To prevent this, we do not allow sending of such spoof emails from our servers.
What can I do about this?
If you have an email script which is not working i.e. the email is not going through, its probably because our server has blocked that email. We’d suggest you to amend your email script in such a way that it incorporates a static sender (from) email address of your domain name, for example - [email protected]
$mailto="[email protected]"; //Enter recipient email address here
$subject = "Test Email";
$from="[email protected]"; //Your valid email address here
$message_body = "This is a test email from Webmaster.";
echo "Your email has been sent successfully";
Save this file with a .php extension and run it; for example, save the file with file name-email.php in your web root directory and run this script by visiting the URL - yourdomain.com/email.php
The email address that you’ve specified as the recipient of the email should have received an email by now :)
You can make use of this email script for your website and customize the changes according to your needs.