im pretty new in using yii, can anyone please tell me how to make attachment from (blob field) in my database so when i send an email using swiftmailer that file from my database can be an attachment of the email. i already succeed in sending email using swiftmailer without attachment. but now i want attach file from database too, i already read how to attach file from specified folder from server but doesnt meet with my case that i want take a file from database…
$user=User::model()->findByPk(Yii::app()->user->id);
$message = new YiiMailMessage();
$message->setTo(array($user->email=>$user->userfullname));
$message->setFrom(array('crazysasshy@gmail.com'=>'staff support Bee'));
$message->setSubject('[#'.$model->ticketno.']'.$model->subject);
$message->setBody($pesan);
$message->attach
$message->attach(Swift_Attachment::fromPath( /*What to write here?<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />*/);
$numsent = Yii::app()->mail->send($message);
but i got another problem, permission denied, i search google and try everything such chmod etc, but still not working, im using windows 7, do u know why?
i end up to delete the file not after i send an email, but after some period of time using try catch, well maybe a cron job is a gud option, but because i still working in localhost, i will try it later