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

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

问题描述

我想从本地主机发送电子邮件,但不知何故邮件不会被发送到任何电子邮件地址。我从本地主机努力配置电子邮件,发现其中一些是指向我,这就是 \\ XAMPP \\ sendmail的\\ sendmail.exe sendemail服务器来配置解决方案。我的问题是,我无法找到sendmail的文件夹在我的XAMPP目录下。所以,不能配置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

能否取悦任何人告诉我,为什么我没有sendmail的文件夹中的XAMPP DIR?

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 credetials,之后去为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

重新启动Web服务器,并与经典的 PHP的mail尝试()函数

下面是我的阳明,我已经使用了symfony项目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 环境变量

你可以找到有用的单证这里和< A HREF =htt​​p://kaamka.blogspot.co.uk/2009/06/httpproxy-environment-variable.html相对=nofollow>这里

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天全站免登陆