For sending emails with attachments, we can use ZEND library, but it make no sense for me to use such a big library just for sending email. Here is simple solution for this problem with couple of simple lines.
require_once("attachment_email.php");
$to = 'gaurav81083@gmail.com'
$from = 'gaurav81083@gmail.com';
$subject = "Mail Subject";
$message = "Mail message goes here.";
$attachment = array();
$attachment[] = array(
'path' => 'complete_file_path/attachment.pdf',
'filename' => 'attachment.pdf',
'type' => 'application/pdf',
);
$email = new AttachmentEmail($to, $from, $subject, $message, $attachment);
$email->send();
The class file (attachment_email.php) can be found here. Just download the file and enjoy your emails with attachments. :)
This is what I was looking for..
ReplyDelete