私のmailto受信者を$ email文字列に設定することは可能ですか? 私は私のウェブサイトに予約フォームを持っています。私はそれから得るメールに2つのボタン(承諾/拒否)を持っています。ボタンは、設定された本文と受信者の電子メールがフォームから自動的に新しい電子メールウィンドウを開きます。私の問題は、フォームからメールをmailtoボタンに入れることができないということです。mailtoの受信者をphp文字列に設定できますか?
いくつかの助けがいいだろう:)
<?php
include dirname(dirname(__FILE__)).'/mail.php';
error_reporting (E_ALL^E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post){
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$phone = stripslashes($_POST['phone']);
$amount = stripslashes($_POST['amount']);
$date = stripslashes($_POST['date']);
$time = stripslashes($_POST['time']);
$message .= "Telefonnummer: ".$phone."\n<br />"."Personen: ".$amount."\n<br />"."Datum: ".$date."\n<br />"."Uhrzeit: ".$time."\n<br />";
$message .= '<html><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="mailto:<?php $email?>?Subject=Reservierung 73BB&Body=Hiermit bestaetigen wir Ihre Reservierung in der ...." target="_blank" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; background-color: #EB7035; border-top: 12px solid #EB7035; border-bottom: 12px solid #EB7035; border-right: 18px solid #EB7035; border-left: 18px solid #EB7035; display: inline-block;">Annehmen →</a></td></tr></table></td></tr></table></html>';
$message .= '<html><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="mailto:<?php $email?>?Subject=Reservierung 73&Body=Leider müssen wir Ihre Reservierung ablehnen da wir schon ausgebucht sind" target="_blank" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; background-color: #EB7035; border-top: 12px solid #EB7035; border-bottom: 12px solid #EB7035; border-right: 28px solid #EB7035; border-left: 18px solid #EB7035; display: inline-block;">Ablehnen →</a></td></tr></table></td></tr></table></html>';
$headers = "From: $name\r\n";
$headers .= "Reply-To: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$mail = mail('[email protected]', 'Reservierung', $message, $headers);
if($mail){
echo 'Ihre Reservierung wurde erfolgreich abgeschickt. Sie erhalten in kürze eine Bestätigung';
}
}
?>
* "私のmailto受信者を$ email文字列に設定できますか?" - 短い答え:はい。 –
*「私の問題は、フォームからメールボタンに電子メールを送信できないことです。」* - どのような形式ですか? btw、あなたはHTMLとして送るので、 '\ n'は本体には必要ありません。それらは文字通り '\ n'を表示します。 –
確かに、 'mailto'計画は大きな落とし穴です。クライアント側にはその機能がサポートされている必要があります。たとえば、単純なWebメーラーのすべてのユーザーは、そのようなボタンをまったく使用できません。 – arkascha