-1

I'm trying to accomplish the following, I'm sending a HTML email using PHP Mailer that reads a html file and embedding a midi file within the HTML file, and it then sends out the email and then the midi file should start playing automatically once the email is opened, is this possible, since it does not seem to work, I'm using Evolution to view the email.

My code looks like this,

HTML FILE "If i open this in my browser it plays but not in email"

<!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 Mailer code

    $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!
    }
?>

Is this at all possible? And how?

4

3 回答 3

5

那将是世界上最烦人的电子邮件

值得庆幸的是,大多数邮件客户端无法识别媒体标签或嵌入式闪存。

于 2010-07-19T07:55:54.023 回答
4

其他人已经告诉过你为什么这是一个坏主意,所以我将跳过它。

没有可靠方法来做你想做的事。

甚至在浏览器中也没有,我们只有几个流行的。但是,当您处理电子邮件客户端时,您必须处理桌面客户端(即使是跨平台的客户端也可以表现不同)和基于 Web 的客户端,您将获得无数种方式来说明您的想法是不可能的。

于 2010-07-19T10:39:35.077 回答
4

不。严重地。如果您希望邮件收件人获得 midi,则在邮件正文中放置一个链接。我能想象的唯一比自动播放音乐的网页更烦人的是一封电子邮件

于 2010-07-19T07:56:42.760 回答