不需要邮件服务器,不使用mail内置函数,一个类就搞定,利用phpmailer类我写了一个自定义函数 sendmail(),very实用!
以前也在几个php论坛上发表过这个发邮件的函数,今天再发,因为today要附上使用例子,如果你还不会用,那就要补补php基础课了。
1.准备文件 sendmail.class.php文件、phpmailer类下载
2.下载后,解压 phpmailer.rar 到服务器的任何目录下
3.打开 sendmail.class.php,修改如下(浅黄色部分是必须 要修改的变量值)
// 以下 5 个变量值必须据实修改 $host = '61.183.41.172'; $username = 'admin@php95.com'; $password = "******" $from = 'admin@php95.com'; $fromname = '天马博客'; // 先设置 $to $subject $content 这三个变量的值,再调用 sendmail 函数来发送邮件 $to = 'nt2030@qq.com'; $subject = '测试phpmailer类发送邮件'; $content = '测试phpmailer类发送邮件'; sendmail($to,$subject,$content);
4.修改 sendmail.class.php 完毕后,运行它..
你的邮件是否发送成功?天马测试本代码,is ok,见证:
本文地址:
转载随意,但请附上文章地址:-)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor
