Questions about sending emails using the phpmailer class. [Size12px] has a CreateBody () method in the phpmailer class. the [size] code is as follows: & nbsp; ** & nbsp; * Assemblesthemessagebody. returnsanemptystringonfailure. & nbsp; * @ access questions about sending emails using the phpmailer class.
[Size = 12px] there is a CreateBody () method in the phpmailer class. [/size]
The code is as follows:
/**
* Assembles the message body. Returns an empty string on failure.
* @ Access public
* @ Return string The assembled message body
*/
Public function CreateBody (){
$ Body = '';
If ($ this-> sign_key_file ){
$ Body. = $ this-> GetMailMIME ();
}
$ This-> SetWordWrap ();
Switch ($ this-> message_type ){
Case 'Alt ':
$ Body. = $ this-> GetBoundary ($ this-> boundary [1], '', 'text/plain ','');
$ Body. = $ this-> EncodeString ($ this-> AltBody, $ this-> Encoding );
$ Body. = $ this-> LE. $ this-> LE;
$ Body. = $ this-> GetBoundary ($ this-> boundary [1], '', 'text/html ','');
$ Body. = $ this-> EncodeString ($ this-> Body, $ this-> Encoding );
$ Body. = $ this-> LE. $ this-> LE;
$ Body. = $ this-> EndBoundary ($ this-> boundary [1]);
Break;
Case 'plain ':
$ Body. = $ this-> EncodeString ($ this-> Body, $ this-> Encoding );
Break;
Case 'attachances ':
$ Body. = $ this-> GetBoundary ($ this-> boundary [1], '');
$ Body. = $ this-> EncodeString ($ this-> Body, $ this-> Encoding );
$ Body. = $ this-> LE;
$ Body. = $ this-> AttachAll ();
Break;
Case 'ALT _ attachments ':
$ Body. = sprintf ("-- % s", $ this-> boundary [1], $ this-> LE );
$ Body. = sprintf ("Content-Type: % s; % s ". "\ tboundary = \" % s \ "% s", 'multipart/alternative ', $ this-> LE, $ this-> boundary [2], $ this-> LE. $ this-> LE );
$ Body. = $ this-> GetBoundary ($ this-> boundary [2], '', 'text/plain ',''). $ this-> LE; // Create text body
$ Body. = $ this-> EncodeString ($ this-> AltBody, $ this-> Encoding );
$ Body. = $ this-> LE. $ this-> LE;
$ Body. = $ this-> GetBoundary ($ this-> boundary [2], '', 'text/html ',''). $ this-> LE; // Create the HTML body
$ Body. = $ this-> EncodeString ($ this-> Body, $ this-> Encoding );
$ Body. = $ this-> LE. $ this-> LE;
$ Body. = $ this-> EndBoundary ($ this-> boundary [2]);
$ Body. = $ this-> AttachAll ();
Break;
}
If ($ this-> IsError ()){
$ Body = '';
} Elseif ($ this-> sign_key_file ){
Try {
$ File = tempnam ('', 'mail ');
File_put_contents ($ file, $ body); // TODO check this worked
$ Signed = tempnam ("", "signed ");
If (@ openssl_pkcs7_sign ($ file, $ signed, "file ://". $ this-> sign_cert_file, array ("file ://". $ this-> sign_key_file, $ this-> sign_key_pass), NULL )){
@ Unlink ($ file );
@ Unlink ($ signed );
$ Body = file_get_contents ($ signed );
} Else {
@ Unlink ($ file );
@ Unlink ($ signed );
Throw new phpmailerException ($ this-> Lang ("signing"). openssl_error_string ());
}
} Catch (phpmailerException $ e ){
$ Body = '';
If ($ this-> conditions ){
Throw $ e;
}
}
}
Return $ body;
}
Problem:
The option array object has been passed from the background. you need to set the option array object content to display in a certain format in the body of the sent file. how can I set it ????
------ Solution --------------------