在php中使用邮件功能将excel文件作为附件发送时出现问题?
我使用下面链接中的代码将excel文件作为附件发送 以下是我使用的代码:在php中使用邮件功能将excel文件作为附件发送时出现问题?,php,excel,attachment,Php,Excel,Attachment,我使用下面链接中的代码将excel文件作为附件发送 以下是我使用的代码: <?php ob_start(); ?> <html> <head><title></title> </head> <body> <body> <center> <table> <tr> <td>Name:</td><td&g
<?php
ob_start();
?>
<html>
<head><title></title>
</head>
<body>
<body>
<center>
<table>
<tr>
<td>Name:</td><td>My Name</td>
</tr>
<tr>
<td>Address:</td><td>My address</td>
</tr>
<tr>
<td>Gender:</td><td>Female</td>
</tr>
</table>
</body></html>
<?php
$FILE_CONTENTS = ob_get_contents();
ob_clean();
// include the class
include("../includes/classes/class.mailer.php");
$recipient = "myid@domain.com";
$from = "myid@domain.com";
// subject
$subject = "Subject of email";
// email message
$message = "
Here goes the message.
";
$myEmail = new EPDEV_Emailer($recipient, $from, $subject);
$myEmail->addText($message);
$myEmail->addFile("my.xls", "application/vnd.ms-excel", $FILE_CONTENTS);
$myEmail->send();
?>
姓名:我的名字
地址:我的地址
性别:女
我在邮件中获得excel文件,但该文件不包含正常excel文件包含的行。但我需要的文件与excel文件包含的行。有人能告诉我可能有什么问题吗
提前谢谢我想你应该把你的问题一分为二:
我猜问题在于生成Excel文件(2),而不是通过电子邮件发送(1)。但这只是一个猜测。您能更具体地说明问题是什么吗?你期望看到的和你实际看到的有什么不同?这会帮助我们帮助你。我照你说的做了。我可以得到适当的excel文件。该文件包含我需要的所有内容。唯一的问题是excel文件中没有行。希望你收到了。谢谢warpech