コード例 #1
0
 function Send()
 {
     try {
         switch ($this->sClass) {
             case 1:
                 include "mail/db_smtp1_class.php";
                 $oClassMail = new Smtp();
                 $oClassMail->Send($this->sEmailTo, $this->sEmailFrom, $this->sSubject, $this->sMsg);
                 break;
             case 2:
                 include "mail/db_smtp2_class.php";
                 $oClassMail = new Smtp();
                 $oClassMail->Delivery('relay');
                 $oClassMail->Relay($this->sHostMail, $this->sUserMail, $this->sPassMail, $this->sPortMail, 'login', false);
                 $oClassMail->From($this->sEmailFrom);
                 $oClassMail->AddTo($this->sEmailTo);
                 $oClassMail->Html($this->sMsg);
                 $oClassMail->Send($this->sSubject);
                 break;
             default:
                 $sHeader = "From: {$this->sEmailFrom} <{$this->sEmailFrom}>";
                 if (!mail($this->sEmailTo, $this->sSubject, $this->sMsg, $sHeader)) {
                     throw Exception("Função mail");
                 }
                 break;
         }
         return "Uma mensagem foi encaminhada para o e-mail informado";
     } catch (Exception $eException) {
         return "01 - Erro ao enviar E-mail. " . $eException->getMessage();
     }
 }