私は現在、PHPのニュースレターシステムに取り組んでいます。さまざまな顧客に大量の電子メールメッセージをすばやく送信できます。
さて、[tags]
テキストエリアにどのように追加できるのか疑問に思いました。タグをインスタンスに[name]
追加してメッセージに追加します。各電子メールメッセージの名前は受信者の名前と同じであることが意図されています。
誰かがおそらくこれがどのように行われるか考えていますか?
私は現在、PHPのニュースレターシステムに取り組んでいます。さまざまな顧客に大量の電子メールメッセージをすばやく送信できます。
さて、[tags]
テキストエリアにどのように追加できるのか疑問に思いました。タグをインスタンスに[name]
追加してメッセージに追加します。各電子メールメッセージの名前は受信者の名前と同じであることが意図されています。
誰かがおそらくこれがどのように行われるか考えていますか?
質問はちょっと広いです、私は問題が何であるか本当にわかりません、しかしこれはトリックをするでしょう。明らかに、できることはたくさんありますが、ここから始めて、上に向かって進んでいきます。
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);
データベースからメッセージまたはテンプレートをフェッチして電子メールを送信する場合、次のようなものを使用できます。
$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);
私はとても解決しました:
ページ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>
';
<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>