使用php输出原始电子邮件 [英] OUTPUT raw email with php

查看:258
本文介绍了使用php输出原始电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定是否有人可以帮助我。我正在使用我的默认电子邮件地址来管道到某个PHP脚本。所有我想要的PHP脚本都是读取收件人是谁,并将电子邮件发送给所述收件人,大多数情况下都不受影响。我知道如何解析电子邮件并阅读收件人(这是简单的部分)。所有我需要的是一种发送原始电子邮件文本(将使用fopen拉出)的方法,而不必将其插入到使用单独参数的''to'',''subject'',''消息的函数中'等等,字段。基本上,我只是想将一个原始的电子邮件文件转储到一个函数中让她飞起来。


我想这样做的原因是我可以设置一个动态的电子邮件转发系统。然后,发送到我们数据库中用户名的电子邮件会转发到他们在帐户设置中指定的电子邮件地址。我有一个共享的托管计划(通过hostgator),我很相信使用PHP的方法是我执行此类任务的唯一选择。我也愿意打赌它与sendmail有关但我不知道从哪里开始。


或许我也可以弄明白怎么样通过查看mail()函数的内部工作原理来做到这一点?然而,我也不知道在哪里可以找到它。


任何帮助都会非常感激!!

谢谢 - nate

not sure if anyone can help me with this. i''m using my default email address to pipe to a certain php script. all i want the php script to do is read who the recipients are and send the email to said recipients mostly untouched. i know how to parse the email and read the recipients (that''s the easy part). all i need is a way to send out the raw email text (which will be pulled using fopen ) without having to plug it into a function that uses separate parameters for the ''to'', ''subject'', ''message'', etc, etc, fields. essentially, i just want to dump a raw email file into a function and let her fly.

the reason why i want to do this is so i can set up a dynamic email forwarding system. an email addressed to a username in our database is then forwarded to the email address they have specified in their account settings. i have a shared hosting plan (through hostgator) and i''m fairly sure that a method using php is my only option to perform a task such as this. i''m also willing to bet it has something to do with sendmail but i don''t have the slightest clue on where to begin.

perhaps also i could figure out how to do this by looking at the inner workings of the mail() function? i haven''t figured out where to find that either, however.

any help would be much appreciated!!
thanks - nate

推荐答案

我不认为PHP有​​你想要的功能,除非你愿意说出来自己发送电子邮件标题。


或者您可以在服务器计算机上运行本地SMTP服务器并使用PHP的套接字函数连接到它。这几乎是mail()的工作原理。您可以使用ini_get()获取php.ini文件中的所有设置以获得零配置脚本。

实际上,这比表示数据的速度稍快。
I don''t think PHP has the capabilities you are looking for, unless you are willing to phrase the email headers yourself.

Or you could run a local SMTP server on the server machine and use PHP''s socket functions to connect to it. This is pretty much how mail() works. You can get all settings from the php.ini file using ini_get() for a zero configuration script.
This is in fact, slightly faster than phrasing data.


实际上,是的,电子邮件标题已经构建完毕。我想要改变的是收件人字段。那么我怎样才能以这种方式使用php?


我也会研究你对smtp的看法。谢谢你的回复


nate
actually, yes the email headers are already constructed. all i want to change is the recipient fields. so how can i use php in this way?

i will also look into what you said about smtp. thanks for the reply

nate


< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号


这篇关于使用php输出原始电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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