Senden einer mehrteiligen E-Mail mit (HTML, Nur-Text und Anhang) in PHPPhp

PHP-Programmierer chatten hier
Anonymous
 Senden einer mehrteiligen E-Mail mit (HTML, Nur-Text und Anhang) in PHP

Post by Anonymous »

Ich sende eine mehrteilige E-Mail mit PHP mit HTML-Formatierung und einem Anhang...
Alles funktioniert gut, aber wenn der Benutzer diese E-Mail von unserer Website erhält, wird die Grenze auch im letzten Teil des HTML-Teils angezeigt.
Aber wenn ich die Grenzlinie entferne, zeigt die E-Mail den Dateiinhalt als Base64 an (kein Anhang).

Code: Select all

 if ( isset($_POST['submit']) )
{
$to = '[email protected]';
$FromSubmitting = $_POST['submitting'];
$FromTitle = $_POST['title'];
$FromName = $_POST['name'];
$FromDesignation = $_POST['designation'];
$FromQualification = $_POST['qualification'];
$FromInstitute = $_POST['institute_address'];
$FromHomeAddress = $_POST['home_address'];
$FromEmail = $_POST['email'];
$FromWorkPhone = $_POST['work_phone_number'];
$FromHomePhone = $_POST['home_phone_number'];
$FromMobilePhone = $_POST['mobile_phone_number'];
$FromPresentingAuthor = $_POST['presenting_author'];
$FromConferenceTheme = $_POST['conference_theme'];
$FromTypeOfSubmission = $_POST['type_of_submission'];

$subject = "New ".$FromSubmitting." Submitted From: ".$FromName;

/* GET File Variables */
$tmpName = $_FILES['uploaded_file']['tmp_name'];
$fileType = $_FILES['uploaded_file']['type'];
$fileName = $_FILES['uploaded_file']['name'];
/* Start of headers */
$headers = "From: $FromEmail";

if (file($tmpName)) {
/* Reading file ('rb' = read binary)  */
$file = fopen($tmpName,'rb');
$data = fread($file,filesize($tmpName));
fclose($file);   /* a boundary string */
$randomVal = md5(time());
$mimeBoundary = "==Multipart_Boundary_x{$randomVal}x";

/* Header for File Attachment */
$headers .= "\nMIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed;\n" ;
$headers .= " boundary=\"{$mimeBoundary}\"";

/* Multipart Boundary above message */

$message .= "--{$mimeBoundary}\n"
. "Content-Type: text/html; charset=UTF-8\n"
. "Content-Transfer-Encoding: 8bit\n\n"
. "
Submission Type:$FromSubmitting
Name:$FromTitle $FromName
Designation:$FromDesignation
Qualification:$FromQualification
Institute:$FromInstitute
Home Address:$FromHomeAddress
Work Phone:$FromWorkPhone
Home Phone:
$FromHomePhoneMobile Phone:
$FromMobilePhone
Presenting Author:$FromPresentingAuthor
Conference Theme:$FromConferenceTheme
Type of Submission:$FromTypeOfSubmission
"
.  "--{$mimeBoundary}\n"; // when removing this line it shows Image-2

/* Encoding file data */
$data = chunk_split(base64_encode($data));

/* Adding attchment-file to message*/
$message .= "--{$mimeBoundary}\n"
.  "Content-Type: {$fileType};\n"
.  " name=\"{$fileName}\"\n"
.  "Content-Transfer-Encoding: base64\n\n"
.  $data . "\n\n"
.  "--{$mimeBoundary}--\n";
}

$flgchk = mail ("$to", "$subject", "$message", "$headers");

}
E-Mail-Screenshot Bild-1:
Image


E-Mail-Screenshot Bild-2:
Image

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post