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

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

问题描述

我正在尝试从本地主机发送电子邮件,但不知何故邮件没有发送到任何电子邮件地址。我试图通过配置来自localhost 的电子邮件,找到一些解决方案,指出我使用 \xampp\sendmail\sendmail.exe 的sendemail服务器进行配置。我的问题是我在我的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 \xampp\sendmail\sendmail.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

__编辑__

尝试使用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!";
}

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

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