برای ارسال ایمیل از 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] => 'info@samaiweb.com'
[FromName] => 'abdollah'
[Sender] => 'info@samaiweb.com'
[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 => 'abdollah_sam@yahoo.com'
1 => ''
]
]
[*:cc] => []
[*:bcc] => []
[*:ReplyTo] => [
'info@samaiweb.com' => [
0 => 'info@samaiweb.com'
1 => 'abdollah'
]
]
[*:all_recipients] => [
'abdollah_sam@yahoo.com' => 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] => ''
)
متشکرم.
برچسب:
نویسنده: خنجی