mail = new Frody\Util\PHPMailer; } private function ness_field( $authlogin=false ){ if( !$this->to_mail ){ echo "[to_mail] is necessary!"; return true; } if( !$this->from_mail ){ echo "[from_mail] is necessary!"; return true; } if( !$this->subject ){ echo "[subject] is necessary!"; return true; } if( !$this->mailbody ){ echo "[mailbody] is necessary!"; return true; } if( $authlogin ){ if( !$this->smtp_id ){ echo "[smtp_id] is necessary!"; return true; } if( !$this->smtp_pwd ){ echo "[smtp_pwd] is necessary!"; return true; } } return false; } public function send(){ if( $this->ness_field() ){ return false; } //$mail->isSendmail(); $this->mail->CharSet = $this->charset; $this->mail->Encoding = 'base64'; $this->mail->setFrom($this->from_mail, $this->from_name); $this->mail->addReplyTo($this->from_mail, $this->from_name); $this->mail->addAddress($this->to_mail, $this->to_name); $this->mail->Subject = $this->subject; $this->mail->msgHTML($this->mailbody); $this->mail->AltBody=strip_tags($this->mailbody); if (!$this->mail->send()) { return false; } else { return true; } } public function smtp(){ if( $this->ness_field($this->authlogin) ){ return false; } $this->mail->isSMTP(); $this->mail->SMTPDebug = 0; //1 발송서버메세지, 2 발송/수신서버메세지 $this->mail->Host = $this->host; $this->mail->Port = $this->port; $this->mail->SMTPSecure = $this->secure; $this->mail->SMTPAuth = $this->authlogin; if( $this->authlogin ){ $this->mail->Username = $this->smtp_id; $this->mail->Password = $this->smtp_pwd; } $this->mail->CharSet = $this->charset; $this->mail->Encoding = 'base64'; $this->mail->setFrom($this->from_mail, $this->from_name); $this->mail->addReplyTo($this->from_mail, $this->from_name); $this->mail->addAddress($this->to_mail, $this->to_name); $this->mail->Subject = $this->subject; $this->mail->msgHTML($this->mailbody); $this->mail->AltBody=strip_tags($this->mailbody); if (!$this->mail->send()) { return false; } else { return true; } } }