php管道到程序(获取变量)转换回没有标题等的电子邮件格式
我可以通过管道连接到程序,但如何转换电子邮件以便代码可以通过电子邮件发送并由电子邮件客户端读取?我可以通过电子邮件发送它,但它充满了其他字符。我怎样才能得到它而不在页面上显示所有额外的混乱代码。我只想要旧格式的电子邮件,以便可以在电子邮件中阅读。我需要这个来读取 html 和 tex。
#!/usr/bin/php –q
<?
$fd = fopen("php://stdin", "r");
while (!feof($fd)) {
$email .= fread($fd, 1024); }
$to = "[email protected]";
$subject = "Test mail";
$message = $email;
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers); ?>
I can pipe to a program but how do I convert the email so the code can be emailed and read by email clients? I can email it but its full of other chars. How can i get it without all the extra messy code showing up on page. I just want the email in its old format that can be read in an email. I need this to read both html and tex.
#!/usr/bin/php –q
<?
$fd = fopen("php://stdin", "r");
while (!feof($fd)) {
$email .= fread($fd, 1024); }
$to = "[email protected]";
$subject = "Test mail";
$message = $email;
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers); ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些只是电子邮件标头,其中一些是由 esmtp 服务器或中间的任何其他服务器添加的。这与混乱的代码无关,这是客户端对标头的误解。
Those are just e-mail headers, some of them added by the esmtp-server or any other servers in between. Is does not have to do with messy code, it's the misinterpretation of the headers by the client.