私は次のことを達成しようとしています。PHPメーラーを使用してHTMLメールを送信します。このメールはHTMLファイルを読み取り、HTMLファイル内にmidiファイルを埋め込みます。その後、メールが送信され、midiファイルの再生が自動的に開始されます。メールを開いたら、これは可能ですか。機能していないように見えるので、Evolutionを使用してメールを表示しています。
私のコードは次のようになります、
HTMLファイル「ブラウザでこれを開くと再生されますが、メールでは再生されません」
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Template</title>
</head>
<body>
<h1>Song is playing</h1>
<embed src="http://test.mydomain.co.za/song.mid" autostart="true" loop="true" hidden="true" />
</body>
</html>
PHPメーラーコード
$email = $_GET['email'];
//Including the PHP mailer class
require_once 'class.phpmailer.php';
$mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
try {
$mail->AddAddress($email);
$mail->SetFrom('webmaster@mydomain.co.za', 'Webmaster');
$mail->AddReplyTo('webmaster@mydomain.co.za', 'Webmaster');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML(file_get_contents('template.html'));
$mail->Send();
echo "Message Sent OK</p>\n";
}catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
これは可能ですか?そしてどうやって?