简体   繁体   English

如何在Fasthosts帐户上通过PHP和/或CakePHP发送邮件

[英]How to send mail via PHP and/or CakePHP on a Fasthosts account

I've had no need to send mails on my 2 sites hosted at the UK Fasthosts provider. 我不需要在UK Fasthosts提供商托管的2个站点上发送邮件。
But since I've added some email features to one of my sites I've tried to send mail via the Email Component of CakePHP and it doesn't leave the server, even if the send returns success. 但是,由于我已经向我的站点之一添加了一些电子邮件功能,所以我尝试通过CakePHP的电子邮件组件发送邮件,即使发送成功返回,它也不会离开服务器。

I've tried with plain mail() function and with the smtp option and got nowhere. 我已经尝试过使用简单的mail()函数和smtp选项,但是却无济于事。

Any ideas? 有任何想法吗?

I had the same problem with Fasthosts. 我在Fasthosts上遇到了同样的问题。 They have made it so you have to add -f in front of your "sent from" email address so this is what my mail function call looks like: 他们已经做到了,所以您必须在“发送自”电子邮件地址之前添加-f ,这就是我的邮件功能调用的样子:

mail($email_to, $email_subject, $email_message, $headers, '-f'.$email_from);

You can get more info from page on Fasthots help: http://www.fasthosts.co.uk/knowledge-base/?article_id=65 您可以从Fasthots帮助的页面上获取更多信息: http : //www.fasthosts.co.uk/knowledge-base/? article_id=65

I am not familiar with that hosting service but I've had similar experiences with other providers. 我对该托管服务不熟悉,但是与其他提供商也有类似的经历。 The one thing that's worked across them all is the SwiftMailer library. SwiftMailer库是对它们全部起作用的一件事。 Check it out and see if it works for you. 检查一下,看看它是否适合您。

http://swiftmailer.org/ http://swiftmailer.org/

Check out SwitfMail ( http://swiftmailer.org/ ). 查看SwitfMail( http://swiftmailer.org/ )。 You can connect to most mail systems and send email, no local configuration or dependencies. 您可以连接到大多数邮件系统并发送电子邮件,而无需本地配置或依赖项。 I regular send alerts through my gmail account. 我定期通过我的Gmail帐户发送警报。 It's very robust, but has a "simple" execution option if you are not trying to manage email lists. 它非常健壮,但是如果您不尝试管理电子邮件列表,则具有“简单”执行选项。

your code isnt the problem. 您的代码不是问题。 your email server has alot of queued email. 您的电子邮件服务器上有很多排队的电子邮件。 the same issue happend to me with godaddys email server. Godaddys电子邮件服务器也发生了同样的问题。 just give it a day and try again. 给它一天,然后再试一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM