php csv file attachment

<?php

include 'Mail.php';
include 'Mail/mime.php' ;

$text = 'Text version of email';
$html = 'HTML version of email’;
$file = ‘mail.php’;
$crlf = “\n”;
$hdrs = array(
‘From’ => ‘you@yourdomain.com’,
‘Subject’ => ‘Test mime message’
);

$mime = new Mail_mime(array(‘eol’ => $crlf));

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, ‘text/plain’);

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory(‘mail’);
$mail->send(‘mail@gmail.com’, $hdrs, $body);

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s