How to use PHP mail script?

Using a PHP script, you may accept feedback from your website visitors and get the results emailed to you. You can use the sample script provided by globehost.com and tweak it a bit to suit your requirements.

 

In an attempt to keep a check on abuse from globehost.com Hosting Servers, the following conditions have been set for mail scripts on globehost.com Linux Hosting Servers:

  • The domain name in  From email address used in the script should be your domain name hosted with globehost.com


Sample Script

 



 <?
        $mailto="[email protected]";
        $file="thanks.htm";
        $pcount=0;
        $gcount=0;
        $subject = "Mail from Enquiry Form";

        $from="[email protected]";
        while (list($key,$val)=each($_POST))
        {
        $pstr = $pstr."$key : $val \n ";
        ++$pcount;

        }
        while (list($key,$val)=each($_GET))
        {
        $gstr = $gstr."$key : $val \n ";
        ++$gcount;

        }
        if ($pcount > $gcount)
        {
        $message_body=$pstr;
        mail($mailto,$subject,$message_body,"From:".$from);

        include("$file");
        }
        else
        {
        $message_body=$gstr;

        mail($mailto,$subject,$message_body,"From:".$from);
        include("$file");
        }
        ?>

You would need to change the email address in the field $from to any email address on the domain name on which you are incorporating this script.

Example:

If your domain name is yourdomain.com, then you would define the From email address as [email protected].

This email address need not be existing on the mail server of yourdomain.com; however, the domain name in the $from field has to be yours.

You may use an email address such as [email protected].

The value in the $mailto field needs to be changed to the email address, where the email containing the data submitted through the form needs to be delivered.

 

 

 

If still you are Facing any issue Please Click Here to raise a ticket to our Support team

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

What Will Be The SMTP/IMAP Hostname And Port For My Emails:

To get the details for your email SMTP/IMAP, you need to follow the below steps :  1 Go to your...