0

我有一个问题,我已经彻底搜索了互联网,但我找不到解决方案。

我想通过电子邮件发送表格。我希望通过电子邮件发送生成的整个页面。atm 我有这个代码:

<input name="email" type="button" onClick="javascript:location='mailto:test@hotmail.com?subject=Really Cool Website&body=test'"  value= "mail">

这允许我向我发送一封电子邮件到预设的电子邮件地址和主题。身体会说测试。但我似乎无法发送整个页面。有更多的东西缺少 atm,但我的 html/php 是有点生锈的 atm。这将是餐厅的送货单。链接到餐厅网站以供参考它错过了很多 atm 功能,但我正在努力。有谁知道如何能够通过电子邮件发送页面。

提前致谢!整个代码写在下面。

碧玉

<html>
<body> 
<form>
<div>            
      <table width="900" border="0" cellspacing="0" cellpadding="0" class="content">
          <tr>
            <td width="140"><strong>Selecteer hoeveel porties:</strong><br><hr></td>
            <td width="572"><strong>Beschrijving</strong><br><br><hr></td>
            <td width="112"><strong>Prijs</strong><br><br><hr></td>
            <td width="76"><strong>Totaalprijs</strong><br><br><hr></td>
        </tr>
          <tr>
            <td><?php include('optie.php');?></td>
            <td><strong>3-gangen traiteurmenu</strong><br>
                (incl. brood en boter)<br>******<br>
                Creme van gerookte paling<br>******<br>
                Gestoofde hertensukade met aardappelgratin, rodekool en een stoofpeertje.<br>******<br>
                Kerstbal van witte en pure chocolade en een vanillesaus.<br><hr>
                </td>
            <td>&euro;16,50</td>
            <td>&euro;</td>
        </tr>
          <tr>
            <td><?php include('optie.php');?></td>
            <td><strong>Extra voorgerecht</strong><br>
                Gerookte eendenborstfilet met een rilette van eend en een mangochutney.<br></td>
            <td>&euro;5,--</td>
            <td>&euro;</td>
        </tr>
          <tr>
            <td><?php include('optie.php');?></td>
            <td><strong>Extra tussengerecht</strong><br>
                Gamba's geserveerd in een saus van ....?<br><hr></td>
            <td>&euro;5,--</td>
            <td>&euro;</td>
        </tr>
          <tr>
            <td><strong>Diversen</strong></td>
            <td></td>
            <td></td>
            <td></td>

        </tr>
          <tr>
            <td><?php include('optie.php');?></td>
            <td>Graved laks met een mosterd-dillesaus</td>
            <td>&euro;....... per 100 gram</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Kreeftensoep</td>
            <td>&euro;8.95 per 0,5L</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Wildpeper</td>
            <td>&euro;2.35 per 100 gram</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Aardappelgratin</td>
            <td>&euro;2.95</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Rodekool</td>
            <td>&euro;3.95</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Botersaus</td>
            <td>&euro;4,50 per 250 ml.</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>Rode portsaus</td>
            <td>&euro;3.95 per 250 ml.</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td><?php include('optie.php');?></td>
            <td>aangepaste wijnen per fles</td>
            <td>&euro;....... per fles</td>
            <td>&euro;</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td><strong>Totaal prijs:</strong></td>
            <td><strong>&euro;</strong></td>
        </tr>


        <tr>
            <td><strong>Bestellen:</strong></td><td><br>
                U kunt uitsluitend bestellen door middel van ons bestelformulier.
                Uiterlijk voor maandag 17 december inleveren. </td>            
        </tr>
        <tr>
         <td><strong>Afhalen:</strong><br></td>
        </tr>
        <tr>
            <td></td><td> <input type="checkbox" name="option1" value="24 december 12.00-13.00 uur"> 24 december 12.00-13.00 uur</td>
        </tr>
        <tr>            
            <td></td><td> <input type="checkbox" name="option2" value="25 december 12.00-13.00 uur"> 25 december 12.00-13.00 uur</td>
        </tr>
        <tr>            
            <td></td><td> <input type="checkbox" name="option3" value="26 december 12.00-13.00 uur"> 26 december 12.00-13.00 uur<br><br></td>
        </tr>
        <tr>
        <td><strong> Betaling:</strong><br><br><br></td>
        <td>U kunt betalen met pin of contant.<br><br><br></td>
        </tr>
        <tr> 
        <td><strong>Printen</strong></td>
        <td><input type="button" onClick="window.print()" value="Print"/></td>
        <td></td>

        <td>
            <input name="email" type="button" onClick="javascript:location='mailto:test@hotmail.com?subject=Really Cool Website&body=test'"  value= "mail"></td>
  </table>
  </form>


<a href="mailto:coloriteman@gmail.com"></a>
    </div>


</div>
</body>
</html>
4

2 回答 2

0

问题用 PHP 标记 - 但问题中有 PHP 代码,与 PHP 无关。

onClick="javascript:location='mailto:test@hotmail.com?subject=Really Cool Website&body=test'"

当您可以只使用 a href='mailto:...' 时,为什么还要使用 javascript 调用来调用重定向?

它不起作用的最可能原因是您没有正确编码“body”的值。如果它来自 PHP,那么它应该是URLencoded。如果它来自 Javacript,则使用encodeURIComponent。您也应该应用其他参数 - 浏览器能够处理主题中的空格几乎是偶然的。

并非所有的 MUA 都是平等的 - 有时您可以在浏览器和 MUA 之间传递的数据量受到限制。当以这种方式从浏览器调用时,某些邮件客户端将(有效地)截断长正文。

于 2012-08-31T11:33:42.830 回答
0

干得好。我完全修改了你的代码来做你想做的事。请将此标记为正确。=)

<?php
$html = '' .
'<form>' .
'<div>' . 
      '<table width="900" border="0" cellspacing="0" cellpadding="0" class="content">' .
          '<tr>' .
            '<td width="140"><strong>Selecteer hoeveel porties:</strong><br><hr></td>' .
            '<td width="572"><strong>Beschrijving</strong><br><br><hr></td>' .
            '<td width="112"><strong>Prijs</strong><br><br><hr></td>' .
            '<td width="76"><strong>Totaalprijs</strong><br><br><hr></td>' .
        '</tr>' .
          '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td><strong>3-gangen traiteurmenu</strong><br>' .
                '(incl. brood en boter)<br>******<br>' .
                'Creme van gerookte paling<br>******<br>' .
                'Gestoofde hertensukade met aardappelgratin, rodekool en een stoofpeertje.<br>******<br>' .
                'Kerstbal van witte en pure chocolade en een vanillesaus.<br><hr>' .
                '</td>' .
            '<td>&euro;16,50</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
          '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td><strong>Extra voorgerecht</strong><br>' .
                'Gerookte eendenborstfilet met een rilette van eend en een mangochutney.<br></td>' .
            '<td>&euro;5,--</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
          '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td><strong>Extra tussengerecht</strong><br>' .
                "Gamba's geserveerd in een saus van ....?<br><hr></td>" .
            '<td>&euro;5,--</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
          '<tr>' .
            '<td><strong>Diversen</strong></td>' .
            '<td></td>' .
            '<td></td>' .
            '<td></td>' .

        '</tr>' .
          '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Graved laks met een mosterd-dillesaus</td>' .
            '<td>&euro;....... per 100 gram</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Kreeftensoep</td>' .
            '<td>&euro;8.95 per 0,5L</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Wildpeper</td>' .
            '<td>&euro;2.35 per 100 gram</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Aardappelgratin</td>' .
            '<td>&euro;2.95</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Rodekool</td>' .
            '<td>&euro;3.95</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Botersaus</td>' .
            '<td>&euro;4,50 per 250 ml.</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>Rode portsaus</td>' .
            '<td>&euro;3.95 per 250 ml.</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td>' . include('optie.php') . '</td>' .
            '<td>aangepaste wijnen per fles</td>' .
            '<td>&euro;....... per fles</td>' .
            '<td>&euro;</td>' .
        '</tr>' .
        '<tr>' .
            '<td></td>' .
            '<td></td>' .
            '<td><strong>Totaal prijs:</strong></td>' .
            '<td><strong>&euro;</strong></td>' .
        '</tr>' .


        '<tr>' .
            '<td><strong>Bestellen:</strong></td><td><br>' .
                'U kunt uitsluitend bestellen door middel van ons bestelformulier.' .
                'Uiterlijk voor maandag 17 december inleveren. </td>' .     
        '</tr>' .
        '<tr>' .
        '<td><strong>Afhalen:</strong><br></td>' .
        '</tr>' .
        '<tr>' .
            '<td></td><td> <input type="checkbox" name="option1" value="24 december 12.00-13.00 uur"> 24 december 12.00-13.00 uur</td>' .
        '</tr>' .
        '<tr>' .       
            '<td></td><td> <input type="checkbox" name="option2" value="25 december 12.00-13.00 uur"> 25 december 12.00-13.00 uur</td>' .
        '</tr>' .
        '<tr>            ' .
            '<td></td><td> <input type="checkbox" name="option3" value="26 december 12.00-13.00 uur"> 26 december 12.00-13.00 uur<br><br></td>' .
        '</tr>' .
        '<tr>' .
        '<td><strong> Betaling:</strong><br><br><br></td>' .
        '<td>U kunt betalen met pin of contant.<br><br><br></td>' .
        '</tr>' .
        '<tr> ' .
        '<td><strong>Printen</strong></td>' .
        '<td><input type="button" onClick="window.print()" value="Print"/></td>' .
        '<td></td>' .

        '<td>' .
            '<input name="email" type="button" onClick="javascript:location='mailto:test@hotmail.com?subject=Really Cool Website&body=test'"  value= "mail"></td>' .
  '</table>' .
  '</form>' .
  '';

echo '' .
$html .
'<a href="mailto:coloriteman@gmail.com" onClick="javascript:location="mailtotest@hotmail.com?subject=Really Cool Website&body=' . $html . '">Click Here</a>' .
    '</div>' .


'</div>' .
'';
?>

享受!

于 2012-08-31T11:43:06.613 回答