Results 1 to 2 of 2

Thread: sending e-mail via hotmail

  1. #1
    Join Date
    Dec 2006
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face sending e-mail via hotmail

    I am a new to PHP.
    can not figure out how to send an e-mail through website to hotmail directly and not to info@easyto.eu?

    thank you.


    <?
    if($Submitted){
    $arrError = array();
    if(empty($Email)){
    array_push($arrError,'E-mail address is required!');
    }else{
    $strRegularExpression='/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-].+(\.[a-z0-9-]+)+$/';
    if((!preg_match("$strRegularExpression","$Email",$array))){
    array_push($arrError,'E-mail address is invalid!');
    }
    }
    if(empty($Address)){
    array_push($arrError,'Business address is required!');
    }
    if(empty($Message)){
    array_push($arrError,'Message address is required!');
    }
    $strReturnMessage = '';
    if(count($arrError)==0){
    //send email
    $headers = '';
    $headers .= "From: $BusinessName<$Email>\n";
    $headers .= "Reply-To: $BusinessName<$Email>\n";
    $headers .= "Date: ".date("r")."\n";
    $headers .= "Message-ID: <".date("YmdHis")."someone@hotmail.com".$_SERVER['SERVER_NAME'].">\n";
    $headers .= "Return-Path: <someone@hotmail.com>\n";
    $headers .= "Delivered-to: <someone@hotmail.com>\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\n";
    $headers .= "X-Priority: 1\n";
    $headers .= "Importance: High\n";
    $headers .= "X-MSMail-Priority: High\n";
    $headers .= "X-Mailer: SelmanD Mailler With PHP!\n";
    $strSubject = "Contact via someone@hotmail.com";
    $strMessage = "Business name: $BusinessName<br>";
    $strMessage .= "Business website: $WebsiteName<br>";
    $strMessage .= "E-mail: $Email<br>";
    $strMessage .= "Business address: $Address<br>";
    $strMessage .= "Message: $Message<br>";
    mail('info@easyto.eu', $strSubject, $strMessage, $headers);

    $strReturnMessage = 'Thank you! we will contact you as soon as possible';
    $BusinessName ='';
    $WebsiteName ='';
    $Email = '';
    $Address ='';
    $Message ='';

    }else{
    //Get the error message (s)
    $strReturnMessage = '';
    for($i=0;$i<count($arrError);$i++){
    $strReturnMessage.= $arrError[$i]."<br>";
    }
    }
    }
    ?>
    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="urn:schemas-microsoft-comfficeffice" xmlns="http:///TR/REC-html40">


  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Change the address here:
    Code:
    mail('info@easyto.eu', $strSubject, $strMessage, $headers);
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •