برای ارسال ایمیل از phpMailer استفاده کرده ام و کد زیر رو دارم:
public static function sendMail($name,$email,$subject,$body,$toEmail){
$mail = new PHPMailer;
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->CharSet = 'utf8';
$mail->setFrom($email,$name);
$mail->addAddress($toEmail); // Name is optional
$mail->addReplyTo($email,$name);
$mail->Subject = $subject;
$mail->Body = $body;
appcomponentsMyTools::debug($mail,true);
if(!$mail->send()) {
retu false;
} else {
retu true;
}
}
appphpmailerPHPMailer#1 ( [Version] => '5.2.15' [Priority] => null [CharSet] => 'utf8' [ContentType] => 'text/plain' [Encoding] => '8bit' [ErrorInfo] => '' [From] => '[email protected]' [FromName] => 'abdollah' [Sender] => '[email protected]' [RetuPath] => '' [Subject] => 'contact test' [Body] => 'contact test ' [AltBody] => '' [Ical] => '' [*:MIMEBody] => '' [*:MIMEHeader] => '' [*:mailHeader] => '' [WordWrap] => 0 [Mailer] => 'mail' [Sendmail] => '/usr/sbin/sendmail' [UseSendmailOptions] => true [PluginDir] => '' [ConfirmReadingTo] => '' [Hostname] => '' [MessageID] => '' [MessageDate] => '' [Host] => 'localhost' [Port] => 25 [Helo] => '' [SMTPSecure] => '' [SMTPAutoTLS] => true [SMTPAuth] => false [SMTPOptions] => [] [Useame] => '' [Password] => '' [AuthType] => '' [Realm] => '' [Workstation] => '' [Timeout] => 300 [SMTPDebug] => 0 [Debugoutput] => 'echo' [SMTPKeepAlive] => false [SingleTo] => false [SingleToArray] => [] [do_verp] => false [AllowEmpty] => false [LE] => ' ' [DKIM_selector] => '' [DKIM_identity] => '' [DKIM_passphrase] => '' [DKIM_domain] => '' [DKIM_private] => '' [action_function] => '' [XMailer] => '' [*:smtp] => null [*:to] => [ 0 => [ 0 => '[email protected]' 1 => '' ] ] [*:cc] => [] [*:bcc] => [] [*:ReplyTo] => [ '[email protected]' => [ 0 => '[email protected]' 1 => 'abdollah' ] ] [*:all_recipients] => [ '[email protected]' => true ] [*:RecipientsQueue] => [] [*:ReplyToQueue] => [] [*:attachment] => [] [*:CustomHeader] => [] [*:lastMessageID] => '' [*:message_type] => '' [*:boundary] => [] [*:language] => [] [*:error_count] => 0 [*:sign_cert_file] => '' [*:sign_key_file] => '' [*:sign_extracerts_file] => '' [*:sign_key_pass] => '' [*:exceptions] => false [*:uniqueid] => '' )
متشکرم.
برچسب:
نویسنده: خنجی