windows 如何在codeigniter xampp窗口中从本地主机发送电子邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8644500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:44:37  来源:igfitidea点击:

how to send emails from localhost in codeigniter xampp windows

phpwindowsemailcodeigniterxampp

提问by Kanishka Panamaldeniya

xampp , and codeigniter , i want to send emails from my localhost .

xampp 和 codeigniter ,我想从我的本地主机发送电子邮件。

in ubuntu i can create an Email server very easily by

在 ubuntu 中,我可以很容易地创建一个电子邮件服务器

$ sudo apt-get install sendmail

and update the configuration in application/frontend/config/email.php

并更新 application/frontend/config/email.php 中的配置

$config['useragent']           = "CodeIgniter";
$config['mailpath']            = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
$config['protocol']            = "mail";
$config['smtp_host']           = "localhost";
$config['smtp_user']           = "";
$config['smtp_pass']           = "";
$config['smtp_port']           = "25";

i want to setup sendmailin windows , how can i do this ?? please help . search a lot , but could not find a working solution .

我想sendmail在 Windows 中设置,我该怎么做??请帮忙 。搜索了很多,但找不到有效的解决方案。

回答by Pekka

It is possible to set up a mail server on Windows. You'll need a separate product for that, see e.g. hereand here. XAMPPcomes with a mail server bundled.

可以在 Windows 上设置邮件服务器。为此,您需要一个单独的产品,例如参见此处此处XAMPP附带了一个邮件服务器。

However, using a local mail server is rarely wise. Mails coming from a dynamic IP address tend to get swallowed by spam filters, as anybody can do this from any internet connection. It's better to use the SMTP server that is serving the domain name you want to use as the sender domain.

但是,使用本地邮件服务器很少明智。来自动态 IP 地址的邮件往往会被垃圾邮件过滤器吞噬,因为任何人都可以通过任何 Internet 连接执行此操作。最好使用为要用作发件人域的域名提供服务的 SMTP 服务器。

My favourite solution for that is SwiftMailer.It's a replacement for the mail()command and comes with many options. Hereis an example on how to make it work with GMail.

我最喜欢的解决方案是SwiftMailer。它是mail()命令的替代品,并带有许多选项。是有关如何使其与 GMail 一起使用的示例。

SwiftMailer doesn't work with the mail()command though: You'll have to change your PHP code to make this work.

但是 SwiftMailer 不能使用该 mail()命令:您必须更改 PHP 代码才能使其正常工作。

回答by Justin T.

I remember using BLAT, a command line mailer for windows. Dead simple install and usage, providing that you have an SMTP account avalaible. I would recommend this over setting up your own server.

我记得使用BLAT,一个用于 Windows 的命令行邮件程序。安装和使用非常简单,前提是您有一个可用的 SMTP 帐户。我会推荐这个而不是设置你自己的服务器。

It does not however replace mail()directly, nor is a mail server per se, so YMMV.

然而mail(),它不会直接替换,也不是邮件服务器本身,所以 YMMV。

回答by phirschybar

Use a service like authsmtp.com or gridsend.com. I find that these work well for tracking outbound email activity, managing spam boxes, plus you don't have to worry about a different sending environment on your local machine than your production environment.

使用像 authsmtp.com 或 gridsend.com 这样的服务。我发现这些对于跟踪出站电子邮件活动、管理垃圾邮件箱非常有效,而且您不必担心本地计算机上的发送环境与生产环境不同。

回答by luso

You can also try minirelay. Quite easy to use and works fine. http://www.blat.net/miniRelay/

你也可以试试minirelay。非常易于使用且工作正常。 http://www.blat.net/miniRelay/