xampp目录中不存在Sendmail文件夹? [英] Sendmail folder does not exist in xampp directory?

查看:136
本文介绍了xampp目录中不存在Sendmail文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从本地主机发送电子邮件,但不知何故,邮件没有发送到任何电子邮件地址.我正在尝试从 localhost 配置电子邮件,并找到了一些解决方案,这些解决方案指向我使用 sendemail 服务器进行配置,即 xamppsendmailsendmail.exe.我的问题是在我的 xampp 目录中找不到 sendmail 文件夹.所以不能配置sendmail.

I am trying to send email from localhost but somehow mail is not being send to any email address. I am trying to configure email from localhost and found some solution which are pointing me to configure with sendemail server which is xamppsendmailsendmail.exe. My problem is that I can not found sendmail folder in my xampp directory. So can not configure sendmail.

我正在使用 xampp v3.2.1

谁能告诉我为什么我在 xampp 目录中没有 sendmail 文件夹?

Can please anyone tell me that why I don't have sendmail folder in xampp dir?

推荐答案

你必须有SMTP服务器,才能发邮件
替代解决方案是使用外部设备,例如 gmail

You must have SMTP Server, so you can send mails
Alternative solutions is to use externals one, like gmail for example

首先你应该有一个有效的 gmail 凭证,然后去 php.ini 并配置它如下:

First you should have a valid gmail credetials, after that go to php.ini and configure it as follow :

[mail function]
SMTP      = ssl://smtp.gmail.com
smtp_port = 465
username  = YOUR_GOOGLE_USERNAME
password  = YOUR_GOOGLE_PASSWORD

重新启动您的网络服务器并尝试使用经典的 php mail()功能

Restart your web server and try with the classic php mail() function

这是我用于 symfony 项目的 yml SMTP 服务器配置:

Here is my yml SMTP Server configuration that i have used for a symfony project :

parameters:
    mailer_transport: gmail
    mailer_host     : 127.0.0.1
    mailer_user     : anis.halayem@gmail.com
    mailer_password : ***my_gmail_password_secret***
    locale          : en

您可以设置自己的本地 SMTP 服务器本地 SMTP 服务器

You can setup your own local SMTP Server local SMTP Server

__EDIT__

尝试使用 PHPMailer:PHPMailer - 一个全功能的电子邮件创建
它的好处是,它可以让您调试导致使用 gmail smtp 服务器发送邮件的问题

Try with PHPMailer : PHPMailer - A full-featured email creation
And the good thing with it, that it will let you debug what is causing troubles with sending mails using gmail smtp server

第一件事:你在代理后面吗?如果是这种情况,则必须配置 HTTP_PROXY/HTTPS_PROXY 环境变量
您可以在这里找到有用的文档和这里

First thing : are you behind proxy ? if it's the case, you have to configure the HTTP_PROXY/HTTPS_PROXY environment variables
You can find useful documentations here and here

现在,您可以创建一个 php 测试脚本,您可以通过命令行或使用 Web 服务器直接启动它

Now, you can create a php test script that you can launch directly via commands line or using a web server

<?php
require_once    ('PHPMailer-master/class.phpmailer.php');
require_once    ('PHPMailer-master/class.smtp.php');

$mail               = new PHPMailer();
$body               = "<h1> Sending HTML Mails using gmail</h1><p>it's great !!</p>";
$mail->IsSMTP();                                        // telling the class to use SMTP
$mail->SMTPDebug    = 1;                                // enables SMTP debug information (for testing)
$mail->SMTPAuth     = true;                             // enable SMTP authentication
$mail->SMTPSecure   = "tls";                            // sets the prefix to the servier
$mail->Host         = "smtp.gmail.com";                 // sets GMAIL as the SMTP server
$mail->Port         = 587;                              // set the SMTP port for the GMAIL server

$mail->Username     = "YOUR_GMAIL_ACCOUNT"  ;           // GMAIL username
$mail->Password     = 'YOUR_GMAIL_PASSWORD' ;           // GMAIL password

$mail->SetFrom('VALID_USER@gmail.com', 'Anis Halayem');
$mail->Subject    = "Test Send Mails";
$mail->MsgHTML($body);
$address = "VALID_USER@gmail.com";
$mail->AddAddress($address, "USER NAME");

// $mail->AddAttachment("images/phpmailer.gif");        // attachment
// $mail->AddAttachment("images/phpmailer_mini.gif");   // attachment

if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else {
    echo "Message sent!";
}

这篇关于xampp目录中不存在Sendmail文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆