

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















Output: The mail was sent to [email protected] successfully.
Can collect the data through HTML forms and can send an email. Should create one HTML program to collect information like to-address, subject, message from user; and one PHP program to send mail using these information.
[email protected] [email protected] Hello World…. …. We will be there soon!
Output: The mail was sent to [email protected], [email protected], [email protected] successfully.
Output: The mail was sent to [email protected] cc:[email protected], [email protected] bcc: [email protected] successfully.
Tell the e-mail client that data is coming in multiple parts—in this instance, plain text and HTML. This tells the e-mail client to look for additional “Content-type” information in the message, which includes boundary information. The boundary is what separates the multiple parts of the message. Email – MultiPart messages
Note: Here, every information has to be separated with a boundary value. Email with an attachment
The above steps will explain in detail with program codes
3.1 Now can add message which has to send as a plain or HTML: $email_message .= “your file has been sent as an attachment to the user specified by you”. 3.2. Now add attributes for message. $email_message .= "This is a multi-part message in MIME format.\n\n" ."-- {$mime_boundary}\n". "Content-Type:text/html; charset="iso- 8859 - 1 "\n". "Content-Transfer-Encoding: 7bit\n\n". After done all the above use mail() as follows: $headers = "\nMIME-Version: 1.0\n" ."Content-Type: multipart/mixed;\n" ." boundary="{$mime_boundary}""; $sent=mail($to, $sub, $email_message,$headers);
The following slides show the sample email program with an attachment php /* IMAGE ATTACHMENT $fileatt = "test1.jpg"; // Path to the file $fileatt_type = "image/jpg"; // File Type $fileatt_name = "test1.jpg"; // Filename that will be used for the file as the attachment */ // TEXT ATTACHMENT $fileatt = "MYSQL-PHP.pdf"; // Path to the file $fileatt_type = "application/pdf"; // File Type $fileatt_name = "PHPebook.pdf"; // Filename that will be used for the file as the attachment