xampp php_mailer,如何配置XAMPP从本地主机发送邮件?

你必须配置SMTP在你的服务器上。你可以用G套房SMTP谷歌免费:<?php

$mail = new PHPMailer(true);// Send mail using Gmailif($send_using_gmail){

$mail->IsSMTP(); // telling the class to use SMTP

$mail->SMTPAuth = true; // enable SMTP authentication

$mail->SMTPSecure = "ssl"; // sets the prefix to the servier

$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server

$mail->Port = 465; // set the SMTP port for the GMAIL server

$mail->Username = "your-gmail-account@gmail.com"; // GMAIL username

$mail->Password = "your-gmail-password"; // GMAIL password}

// Typical mail data

$mail->AddAddress($email, $name);$mail->SetFrom($email_from, $name_from);

$mail->Subject = "My Subject";$mail->Body = "Mail contents";try{

$mail->Send();

echo "Success!";} catch(Exception $e){

// Something went bad

echo "Fail :(";}?>

阅读更多关于PHPMailer 这里.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值