I'm executing it on unix shared hosting account on command line but it does not send any email. What is the problem in this? I've got the code from : PHP: How to send email with attachment using smtp settings? but still it does not work.
<?php
include('Mail.php');
include('Mail/mime.php');
// include_once('Mail/mime.php');|
// The code below composes and sends the email|
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = './a.php';
$crlf = "\r\n";
$hdrs = array("From"=>'contactus@site.com', "Subject"=>"hello" ,"Reply-To"=>"contactus@site.com");
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file,'application/octet-stream');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail', $params);
$mail->send('rag.7raggupta@gmail.com', $hdrs, $body);