Using a PHP Email Script
Print
  • 0

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 - info@yourdomain.com


Here’s an awesome test PHP script we’ve just made for you so that we can get you right:

<?

      $mailto="anyone@anyone.com";  //Enter recipient email address here

       $subject = "Test Email";

       $from="you@yourdomain.com";          //Your valid email address here

       $message_body = "This is a test email from Webmaster.";

       mail($mailto,$subject,$message_body,"From:".$from);

       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.

Byla tato odpověď nápomocná?

Související články