Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SendEMailZend($to, $subject, $body, $cc=null, $bcc=null, $attachment=null){
- $pconf = new ParametriConfigurazione();
- $from=$pconf->Get('from_email');
- $tr = new Zend_Mail_Transport_Sendmail();
- Zend_Mail::setDefaultTransport($tr);
- $mail = new Zend_Mail('UTF-8');
- $mail->setBodyText($body);
- $mail->setFrom($from, 'Trinity College London');
- if(is_array($to)){
- foreach($to as $to_address){
- $mail->addTo($to);
- }
- }else{
- $mail->addTo($to);
- }
- if(is_array($cc)){
- foreach ($cc as $cc_address){
- $mail->addCc($cc_address);
- }
- }else if(!is_null($cc)){
- $mail->addCc($cc);
- }
- if(is_array($bcc)){
- foreach($bcc as $bcc_address){
- $mail->addBcc($bcc_address);
- }
- }else if(!is_null($bcc)){
- $mail->addBcc($bcc);
- }
- if(!is_null($attachment)){
- $at = new Zend_Mime_Part($attachment['content']);
- $at->type = $attachment['mime'];
- $at->disposition = Zend_Mime::DISPOSITION_INLINE;
- $at->encoding = Zend_Mime::ENCODING_BASE64;
- $at->filename = $attachment['filename'];
- $mail->addAttachment($at);
- }
- $mail->setSubject($subject);
- $mail->send();
- }
Add Comment
Please, Sign In to add comment