Monday, August 8, 2011

Email with an attachment

Hello folks,

I want to send an email with an attachment. I have used the following
snippet but its not working.

I have created a file called attach.txt in /app/webroot/

$this->Email->filePaths = array('/www/app/webroot/');
$this->Email->attachments =array('attach.txt');
$this->Email->to = 'abc@abc.com'; //its a dummy id
$this->Email->subject = 'Something';
$this->Email->replyTo = 'ambika@checksuminfosoft.com';
$this->Email->from = 'ambika@checksuminfosoft.com';
$this->Email->sendAs = 'html';
$mailBody = "Hello ";
if($this->Email->send("would like to review a file") ){
die('Email Sent!');
}else{
die('Failed to send email');
}

as soon as i execute this i am getting following error

Fatal error: Call to undefined function vendor() in /var/www/pmvc/app/
controllers/components/email.php on line 73

Following function is present at line no 73 in email.php file

function send()
{
vendor('phpmailer'.DS.'class.phpmailer'); ----->This is line no 73

$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Host = $this->smtpHostNames;
$mail->Username = $this->smtpUserName;
$mail->Password = $this->smtpPassword;

...
}

Regards
Ambika

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate