Advertisement
Guest User

Untitled

a guest
Jan 28th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.79 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors',1); // enable php error display for easy trouble shooting
  3. error_reporting(E_ALL); // set error display to all
  4. $_POST['submit'] = 'submit';
  5. $_POST['email1'] = 'test1@email.com';
  6. $_POST['email2'] = 'test2@email.com';
  7. $_POST['email3'] = 'test3@email.com';
  8.  
  9. if(isset($_POST['submit'])) {
  10.     $email_to = "666international@mail.com" . "sohaanmashwani@gmail.com" . "cinephoto@mail.com" ; // The email you are sending to (example)
  11.     $email1_from = $_POST['email1']; // The email you are sending from (example)
  12.     $email2_from = $_POST['email2'];
  13.     $email3_from = $_POST['email3'];
  14.     $email_subject = "Emails Record"; // The Subject of the email
  15.     $email_txt = "text body of message";
  16.     $fileatt = "test.jpg"; // Path to the file (example)
  17.     $fileatt_type = "application/jpg"; // File Type
  18.     $fileatt_name = "email.jpg"; // Filename that will be used for the file as the attachment
  19.     $file = fopen($fileatt,'rb');
  20.     $data = fread($file,filesize($fileatt));
  21.     fclose($file);
  22.     $semi_rand = md5(time());
  23.     $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  24.     $headers="From: " . $email1_from . "," . $email2_from . ",". $email3_from; // Who the email is from (example)
  25.     $headers .= "\nMIME-Version: 1.0\n" .
  26.     "Content-Type: multipart/mixed;\n" .
  27.     " boundary='{$mime_boundary}'";
  28.     $email_message = "This is a multi-part message in MIME format.\n\n" .
  29.     "--{$mime_boundary}\n" .
  30.     "Content-Type:text/html; charset=\"iso-8859-1\"\n" .
  31.     "Content-Transfer-Encoding: 7bit\n\n" . $email_txt;
  32.     $email_message .= "\n\n";
  33.     $data = chunk_split(base64_encode($data));
  34.     $email_message .= "--{$mime_boundary}\n" .
  35.     "Content-Type: {$fileatt_type};\n" .
  36.     " name=\"{$fileatt_name}\"\n" .
  37.     "Content-Transfer-Encoding: base64\n\n" .
  38.     $data . "\n\n" .
  39.     "--{$mime_boundary}--\n";
  40.  
  41.     echo $email_txt;
  42. }
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement