Cheap Domains, $1 .COM Websites! - Free .COM (or $1.99) on Many Products!
 
Only Minimal Purchase Req'd on Many Free/$1.99 .COM Offers.    And Our Sale Domains are Often Under $2 or $3/year with No Further Purchase Req'd.
 
Plus, almost ALWAYS 15% OFF Everything Not Already Discounted.    15% OFF Most Renewals too!      New: Business-Growth Website-Builders and Hosting!
 

 *ICANN fee adds 18¢ many domains; tas applies some areas.  Our $1 Website Builder with Free .COM is based on 12 months at $1/mo.   Multipile or "Stacked" discounts in same purchase often disallowed (may require separate transactions).  Click for details.

 
Cheap Domains Cheap Domain Names

  
Use Promo HDX for at least
Cheap .com
that's not already On Sale!*
 

Cheap Domains     $1 Websites     Free USA-based Sales/Support:  (800) 655-5512
 

.COM $7.64 (Promo: HDX) |  .NET $10.19  |  .SITE $2.99  |  .ORG $9.99  |  .INFO $4.99  |  .UK $7.64  |  .EU $6.79

Cheap Domains include FREE:  100 Email Addresses & Account, Full DNS Control, Domain Forwarding, Masking, Registrant-Change/Transfer, Monitoring/Alerts, Locking, Expiration Protection, More!

Cheap Domains - Find Yours Now:    
 
Most prices shown
use Promo Code: HDX.  This search function, and most product pages, display higher prices at first, but don't worry,  Discounts appear in Shopping Cart when Promo Code Entered    details

Free .COM Domains!   ...with many products...  

 $1 Website Instantly     Business Website Builder

 Most cPanel & Plesk Hosting    Some WordPress Packages

$1.99 .COM Domains   ...on much else, often including:

Many Email, Calendar, Storage Plans Powerful SSL Certificates, more!

 
Terms & Conditions Here.  Add a .COM to Cart to verify price if product description not specific.

 

 
 

 Cheap Website       Cheap WordPress Hosting        Cheap Website Builder - Easy, Instant!    
Cheap Dedicated Servers       Cheap Virtual Private Servers      
Blogcast and Podcast 

 
Cheap Domains | Availability Check:
 
  

Frequently Asked Questions

Help Center Search

Create a Form Mailer for Linux Virtual Dedicated/Dedicated Servers

Print this Article
Last Updated: August 1, 2017 10:55 AM

To use a PHP form-mailer on a Linux Dedicated or Virtual Dedicated server, create a Web form in HTML that links to a PHP file and upload it to your server. An example script is seen below.

For more information on configuring mail servers see What are the relay mail server settings on my dedicated server?.

<?php

// $mail_to and $mail_from must be set.

$mail_to = ''; // Who is the E-Mail going to?
$mail_from = ''; // Where does the E-Mail appear to be from?

// OPTIONAL SETTING
$redirect_url = ''; // Example: http://domain.com/thankyou.html - must be a FULL URL.

############################
# DO NOT EDIT BELOW THIS #
############################

// Fail if _POST and _GET are empty. Nothing to process.
if(count($_POST) == 0 AND count($_GET) == 0):
echo 'This form handler does nothing if visited directly. You must submit form data to this script.';
exit;
endif;

// Fail if $mail_to or $mail_from are not set.
if(empty($mail_to) OR empty($mail_from)):
echo 'You must edit this script and set the appropriate values for $mail_to and $mail_from.';
exit;
endif;

// Set $fields to whichever method is being used.
$fields = (count($_POST) > 0 ) ? $_POST : $_GET;

$message_body = "Form Submission \n\n";

foreach ($fields as $field => $value):
switch(strtolower($field)):
case 'redirect':
$redirect = $value;
break;
case 'subject':
$subject = $value;
break;
endswitch;
if (strtolower($field) != 'redirect' AND strtolower($field) != 'submit' AND strtolower($field) != 'subject'):
$message_body .= strtoupper($field) . ": " . $value . "\r\n";
endif;
endforeach;

// Set the redirect URL from the form (if set). $host_url is a default action if $redirect isn't set
$redirect = (empty($redirect_url)) ? $redirect : $redirect_url;
$host_url = $_SERVER['HTTP_HOST'];

// Set the message subject based upon a subject field being set or not.

$message_subject = (!empty($subject)) ? $subject : 'Message from '.$_SERVER['HTTP_HOST'];

$headers = 'From: ' . $mail_from. "\r\n" .
'Reply-To: ' . $mail_from . "\r\n" .
'X-Mailer: PHP/' . phpversion();

// Remove potentially injected headers from the body

if (!mail($mail_to, $message_subject, $message_body, $headers)):
echo "Message Send Failed.";
endif;

if(empty($redirect)):
header("Location: http://{$host_url}");
else:
header("Location: {$redirect}");
endif;
?>

Cheap Domain Names
 


Toll Free Technical Support from a USA Call Center, 24 hours a day, 365 days a year:    (800) 655-5512
 
Call us with any sales or support question.     Place Orders by Phone.    Our USA-based Help Desk speaks your language.
 

Call Centers located in the Greater Phoenix metro area and Central Iowa, USA.     Technical Support also available in Spanish   New to Us?  Get a free account in 60 seconds.


 

 

 $1 Cheap Domains   |   $1 Websites   |   Product Catalog   |   Sale Price FAQ   |   Help Pages   |   FAQ   |   Free Phone Support   |   Free WHOIS Lookup   |   My Cart   |   Login

 
ICANN fee of 18 cents [$0.18] may apply on some domain names.    Notice for .eu and some other registering inbound
domain transfers: WHOIS may show domain held under registry
Weiled Weast Domains and/or HostingDude.com.   Legal Agreements.

(https://legacy.hostingdude.com)
 

 


 

Copyright © 2003 - 2019  HostingDude, Inc.  All Rights Reserved.  No reprint or re-use without written authorization.