邮寄到php之前的确认页面 [英] confirmation page before mailing in php

查看:96
本文介绍了邮寄到php之前的确认页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

确认消息邮寄到php

我是开发一个页面,我的老板将在数据库中搜索一家公司。一旦他点击了它的名字,电子邮件格式将被显示(以HTML形式)作为确认页面。然后会有一个按钮(或链接?我仍然不确定使用哪个),然后将邮件发送到该特定公司。

I am developing a page where in my boss will search for a company in a database. Once he clicks on its name, an email format will be shown (done in html) as a confirmation page. And then there will be a button (or link? i'm still not sure which to use) which will then send the mail to that particular company.

<img src="../../img/emmlogo.jpg" style="left: 0;position: absolute; width: 75px;"/>
<body style="padding: 0 0 0 100px;position: relative;">
<?php echo date("F d, Y ");?>  <br><br>

<b> echo $row_Recordset1['First Name'].'&nbsp'.$row_Recordset1['Middle Initial'].'&nbsp'.$row_Recordset1['Last Name']; ?></b><br>
<?php echo $row_Recordset1 ['Position'].'<br>'.$row_Recordset1['Company Name'].'<br>'.$row_Recordset1['Corporate Address'];?><br><br>

<p>Dear <?php echo $row_Recordset1['Last Name']; ?>:</p>

我只收到确认页面,全部设置。我只是想知道是否可以发送信息,而不必重复我所做的确认页面的查询,我希望邮件看起来像我做了html。我可以接受任何意见或建议,因为这个网站帮助我很大程度上开发了这个特定的项目。谢谢

I've only gotten to the confirmation page and it's all set. I just want to find out if it is possible that I can send the information without having to repeat the queries from the confirmation page that I made and I want the mail to look exactly as how I made the html. I am open to any comments or suggestions as this site has helped me a lot in developing this particular project. thank you

推荐答案

首先,如果您打算发送此HTML,首先应该摆脱图片的相对路径...提供链接到每个人都可以访问的服务器。

First you should get rid of relative paths for your pictures if you intend on sending this HTML... provide links to servers that are accessible to everybody.

你可以做的是发送一个HTML电子邮件(大量的库已经为你做了)。如果要直接重新使用您的确认页面,请考虑使用 ob_start ob_end_clean 。在这两个调用之间,查询生成预览的脚本,并使用 ob_get_contents 将其转储到缓冲区中。这应该可以避免您编写代码两次。

What you can do is send an HTML email (plenty of libraries already do that for you). If you want to reuse directly your confirmation page, consider the usage of ob_start and ob_end_clean. In between these two calls, query your script that generates the preview and dump it into a buffer using ob_get_contents. This should save you from writing the code twice.

以下是我项目之一的示例代码:

Here's sample code from one of my project:

ob_start(); // turn on output buffering
require("mails/email_preview.php"); // include, require, process whatever you want to fill the buffer with
$_body=ob_get_contents(); // get the content of the buffer
ob_end_clean(); // erase the buffer and turn off output buffering

$this->sendMail($_emailAddress, "Email Title", $_body);

有用的链接:

  • ob_start
  • ob_get_contents
  • ob_end_clean

这篇关于邮寄到php之前的确认页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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