php注册后发送验证电子邮件

php注册后发送验证电子邮件,php,email,ubuntu,xampp,Php,Email,Ubuntu,Xampp,我不熟悉PHP、PHPMyAdmin、Localhost等。。我目前正在建立一个网站,我正在本地主机上测试,我已经在Ubuntu上安装了Xampp。我想制作一个注册表格,它可以很好地工作,所有东西都会进入我的数据库,但我想看看哪些用户实际上激活了他们的帐户 所以我想制作一封带有唯一代码的验证邮件。现在的问题是,我试图键入:mail$to、$subject、$message、$headers,但我发现它不起作用 我试图安装sendmail、postfix、dovecot、telnet等,但似乎没有

我不熟悉PHP、PHPMyAdmin、Localhost等。。我目前正在建立一个网站,我正在本地主机上测试,我已经在Ubuntu上安装了Xampp。我想制作一个注册表格,它可以很好地工作,所有东西都会进入我的数据库,但我想看看哪些用户实际上激活了他们的帐户

所以我想制作一封带有唯一代码的验证邮件。现在的问题是,我试图键入:mail$to、$subject、$message、$headers,但我发现它不起作用

我试图安装sendmail、postfix、dovecot、telnet等,但似乎没有任何效果,我也找不到一个好的演练

我使用以下工具:ubuntu 12.04LTS、xampp php5.5、localhost/phpmyadmin


如果有人知道一个好的演练,或知道如何使这项工作,我会非常感激

下面是一个简短的教程,可能会有所帮助

您是否用这一行更新了php.ini文件

sendmail_path = "/usr/sbin/sendmail -t -i"

然后重新启动apache。

您可以尝试使用PHPMailer。它是用PHP发送电子邮件的强大库

这里我给大家举一个例子。 首先,为您的计算机下载PHPMailer。 其次,在安装PHPMailerAutoload.php时,需要该位置的PHPMailerAutoload.php。在我的示例中,它位于phpmailer目录中。此phpmailer与我的应用程序位于同一目录中,因此:

<?php
require 'phpmailer/PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.gif');

//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
?>
我从phpmailergithub的

如果你有一个GMail帐户可以发送电子邮件,你也可以使用它

还有其他例子

让我们知道你是怎么修好的。
祝你好运。

安装postfix的教程请键入:sendmail sample尝试发送邮件功能-email@example.org在命令行中。然后,按ctrl+D键发送消息,如果evrything设置正确,则schould将向sample发送邮件-email@example.orgI已经更新了我的php.ini邮件,我遵循了教程,但没有收到邮件