0

我目前正在开发一个 PHP 通讯系统。我可以快速向不同的客户发送大量电子邮件。

好吧,我想知道如何添加[tags]文本区域。我会将标签[name]添加到我的消息中,并且它旨在使每封电子邮件的名称等于收件人的名称。

有没有人知道这是怎么做到的?

4

4 回答 4

1

这个问题有点奇怪,我不太确定问题是什么,但这可以解决问题。显然,您可以做很多不同的事情,但从这里开始,逐步向上。

function getMyNewsletter($tags){
    $newsletter = "Hello {$tags['name']}, I hope you liked your {$tags['whattheybought']}. please buy more of my stuff!";
    return $newsletter;
}

$tags = $user->getTagsFromSomewhere();
$mailbody = getMyNewsletter($tags);
yourMailer("SubjectGoesHere",$mailbody,$OtherOptions);
于 2012-04-26T09:39:01.563 回答
1

当您从数据库中获取消息或模板并发送电子邮件时,您可以使用以下内容:

 $message = 'Your HTML Message or Text with your tags like [name]';

 // Replaces the tag [name] with the receiver name from the database 
 $send_message = str_replace('[name]', $fetch['Name'], $message); 
于 2012-04-26T09:41:39.870 回答
0
<head>
    <script type="text/javascript">
        function ModifySelection () {
            var textarea = document.getElementById("myArea");
            if ('selectionStart' in textarea) {
                    // check whether some text is selected in the textarea
                if (textarea.selectionStart != textarea.selectionEnd) {
                    var newText = textarea.value.substring (0, textarea.selectionStart) + 
                        "[start]" + textarea.value.substring  (textarea.selectionStart, textarea.selectionEnd) + "[end]" +
                        textarea.value.substring (textarea.selectionEnd);
                    textarea.value = newText;
                }
            }
            else {  // Internet Explorer before version 9
                    // create a range from the current selection
                var textRange = document.selection.createRange ();
                    // check whether the selection is within the textarea
                var rangeParent = textRange.parentElement ();
                if (rangeParent === textarea) {
                    textRange.text = "[start]" + textRange.text + "[end]";
                }
            }
        }
    </script>
</head>
<body>
    <textarea id="myArea" cols="30" spellcheck="false">Select some text within this field.</textarea>
    <button onclick="ModifySelection ()">Modify the current selection</button>
</body>
于 2013-03-14T11:33:59.437 回答
0

我很下定决心:

第 1 页:

<table>
       <tr>
           <td>
               <textarea rows="11" cols="70" name="message" id="message" placeholder="your message"></textarea>
           </td>
       </tr>
       <tr>
           <td>
              <script type="text/javascript">
              <!--
                 document.write('<span id="var1" class="insert">[name]</span>, <span id="var2" class="insert">[surnaam]</span>');
              // -->
              </script>
           </td>
       </tr>
</table>

第2页:

 <?php
 $message = $_POST['c_email_message'];
 $mes = $message;
 $mes = str_replace('[voornaam]',$userOb->c_user_name,$mes);                                                                                $mes = str_replace('[achternaam]',$userOb->c_user_surname,$mes);                                                                                


$html_inhoud = '';
$html_inhoud = '
   <table>
       <tr>
           <td>' . htmlentities($mes) . '</td>
       </tr>
   </table>
 ';
于 2012-05-03T10:01:58.123 回答