davehaz
04-10-2006, 05:28 PM
has anybody ever used mime/mail to send email with attachments? I am trying to do this, but having problems, here is the code that I am using.
this part is working.
include('Mail.php');
include('Mail/mime.php');
$file = '/home/site/history.txt';
$crlf = "\n";
$recipients = array(
'To' => 'dave@davehazhomes.com',
);
$hdrs1 = array(
'From' => 'search@nsbsportswear.com',
'Subject' => 'Search History File',
);
$body ="This is a test of sending email through mime";
$mail =& Mail::factory('mail');
$mail->send($recipients,$hdrs1,$body);
but when I add the mime part I get nothing
include('Mail.php');
include('Mail/mime.php');
$file = '/home/site/history.txt';
$crlf = "\n";
$recipients = array(
'To' => 'dave@davehazhomes.com',
);
$hdrs1 = array(
'From' => 'search@nsbsportswear.com',
'Subject' => 'Search History File',
);
$body ="This is a test of sending email through mime";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($body);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs1);
$mail =& Mail::factory('mail');
$mail->send($recipients,$hdrs1,$body);
any help would be most appreciated.
tia.
this part is working.
include('Mail.php');
include('Mail/mime.php');
$file = '/home/site/history.txt';
$crlf = "\n";
$recipients = array(
'To' => 'dave@davehazhomes.com',
);
$hdrs1 = array(
'From' => 'search@nsbsportswear.com',
'Subject' => 'Search History File',
);
$body ="This is a test of sending email through mime";
$mail =& Mail::factory('mail');
$mail->send($recipients,$hdrs1,$body);
but when I add the mime part I get nothing
include('Mail.php');
include('Mail/mime.php');
$file = '/home/site/history.txt';
$crlf = "\n";
$recipients = array(
'To' => 'dave@davehazhomes.com',
);
$hdrs1 = array(
'From' => 'search@nsbsportswear.com',
'Subject' => 'Search History File',
);
$body ="This is a test of sending email through mime";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($body);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs1);
$mail =& Mail::factory('mail');
$mail->send($recipients,$hdrs1,$body);
any help would be most appreciated.
tia.