www.webdeveloper.com
Results 1 to 1 of 1

Thread: fsockopen emailing

Threaded View

  1. #1
    Join Date
    Aug 2010
    Posts
    58

    Angry fsockopen emailing

    hi, i have altered a script i had made that sends emails through fsockopen to include the use of attachments. But it errors and i dont know why because the fread reaches max execution time, could someone tell me what im doing wrong... Here is the script
    PHP Code:


    <?php

    $random_hash 
    md5(date('r'time())); 

    $from_email=$_POST['from_email'];
    $to_email=$_POST['to_email'];
    $from_name=$_POST['from_name'];
    $subject=$_POST['subject'];
    $body=$_POST['body'];

    $headers[]="HELO its_me";
    $headers[]="MAIL FROM:{$from_email}";
    $headers[]="RCPT TO:{$from_email}";
    $headers[]="DATA";
    $headers[]="Received: from you.com by me.com ; Thu, 03 Jan 2006 12:33:29 -0700";
    $headers[]="Date: Thu, 03 Jan 2006 12:33:22 -0700";
    $headers[]="From: {$from_name} <{$from_email}>";
    $headers[]="Subject: {$subject}";
    $headers[]="To: {$to_email}";
    $headers[]="Content-Type: multipart/mixed; boundary='$random_hash'";


    $content[]='Content-Type: text/html';
    $content[]='';
    $content[]=$body;
    $content[]="--".$random_hash;

    if (isset(
    $_FILEs['uploaded'])){
    if (
    $_FILEs['uploaded']['error']==0){

    $content[]='Content-Type: text/html; charset=US-ASCII; name="alert.html"';
    $content[]='Content-Disposition: attachment; filename="alert.html"';
    $content[]='Content-Transfer-Encoding: base64';
    $content[]="";


    }}


    $content[]='.\r\nQUIT\r\n';

    $smtp_server fsockopen("the mailservers hostname"25$errno$errstr30);

    foreach(
    $headers as $i){
    fwrite($smtp_server$i."\r\n");

    }



    foreach (
    $content as $i){
    fwrite($smtp_server$i."\r\n");}


    while(!
    feof($smtp_server)){
    $data=fread($smtp_server,'1026');
    echo 
    "<pre>".$data."</pre>";}

    fclose($smtp_server);





    ?>
    Last edited by brian8765; 07-21-2011 at 08:52 PM. Reason: typo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles