how do change email from my local host to my webserver

Discussion in 'PHP' started by macaela, May 19, 2010.

  1. #1
    hi i was using xampp to create my website but now i changed to a real web host is called dream-hosting.co.uk/ now i my emails sent tru my contact form no longer work bellow is my code using xampp localhost..

          <?php
    // ----------------------------------------- 
    //  The Web Help .com
    // ----------------------------------------- 
    // remember to replace you@email.com with your own email address lower in this code.
    
    // load the variables form address bar
    $subject = $_POST["subject"];
    $message = $_POST["message"];
    $name = $_POST["name"];
    $from = $_POST["from"];
    $verif_box = $_POST["verif_box"];
    
    // remove the backslashes that normally appears when entering " or '
    $message = stripslashes($message); 
    $subject = stripslashes($subject); 
    $name = stripslashes($name); 
    $from = stripslashes($from); 
    
    // check to see if verificaton code was correct
    if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    	// if verification code was correct send the message and show this page
    	mail("xxxxhotmail.co.uk", 'Name: '.$name, 'Telephone: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message,  "From: $from");
    	// delete the cookie so it cannot sent again by refreshing this page
    	setcookie('tntcon','');
    } else if(isset($message) and $message!=""){
    	// if verification code was incorrect then return to contact page and show error
    	header("Location: contact.php?subject=$subject&name=$name&from=$from&message=$message&wrong_code=true");
    	exit;
    } else {
    	echo "no variables received, this page cannot be accessed directly";
    	exit;
    	}
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>E-Mail Sent</title>
    <style type="text/css">
    <!--
    body,td,th {
    	font-family: Arial, Helvetica, sans-serif;
    	font-size: 12px;
    }
    -->
    </style></head>
    
    <body>
    Thank you. Your message has been sent.<br /><br />
    You should receive a reply within 24 hours
    <br /><br />
    Return to <a href="index.html">home page</a> ? 
    </body>
    </html>
    
    
    PHP:

    how do i change to still send the emails to my hotmail account but the difference is that the server is no longer xampp local host but dream hosting?? i tried to change the email address to the one i created form the webhost site like but still didnt work
     
    Last edited: May 19, 2010
    macaela, May 19, 2010 IP
  2. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #2
    Ha, how funny, I used to own dream hosting! :)

    Anyway, try sending your emails via the smtp server rather than the php mail() function. Something like PHPMailer will do the job and allow you to manage the email content a lot better too:

    http://sourceforge.net/projects/phpmailer/files/

     
    mfscripts, May 20, 2010 IP
  3. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    used to own it??? why did u let go?? hope is not cz u realise its a bad host??? anything i should know??
     
    macaela, May 20, 2010 IP
  4. mfscripts

    mfscripts Banned

    Messages:
    319
    Likes Received:
    4
    Best Answers:
    8
    Trophy Points:
    90
    Digital Goods:
    3
    #4
    No definately not a bad host, it was a good 4+ years ago I owned it and i sold it really because I no longer had the time to manage it. The guys that bought it have really grown it since them and all I read are good reviews over the web so you've got nothing to worry about. :)
     
    mfscripts, May 21, 2010 IP