想通过一下代码发送html的表格邮件。怎么发?
以下是邮件正文。想通过txt读取的方式获得字符串。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>表格</title>
</head>
<body>
<h1>学生成绩单</h1>
<table border="1" cellspacing="0" width="50%">
<tr>
<th>编号</th>
<th>姓名</th>
<th>语文</th>
<th>数学</th>
<th>英语</th>
</tr>
<tr>
<td>1</td>
<td>张三</td>
<td>92</td>
<td>87</td>
<td>95</td>
</tr>
<tr>
<td>2</td>
<td>李四</td>
<td>86</td>
<td>93</td>
<td>88</td>
</tr>
<!-- 其他行... -->
</table>
</body>
</html>
以下是邮件发送的代码。总报错
Dim client As New System.Net.Mail.SmtpClient()
client.Host = "maxxxxm"
client.Credentials = New System.Net.NetworkCredential("Producxxxxx@xxxm", "x3xxxxx2.")
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network
Dim message As New System.Net.Mail.MailMessage
message.From = New System.Net.Mail.MailAddress("Proxxxxxice@dawxxxxxom", "数字平台")
message.To.Add("rexxxxx@dxxxxxm")
message.Subject = "主题测试"
message.BodyEncoding = System.Text.Encoding.UTF8
message.IsBodyHtml = True
Dim body As String = FileSys.ReadAllText("C:\Users\12345\Desktop\新文件 1.txt")
message.Body = body
Try
client.Send(message)
msgbox("发送成功")
Catch ex As Exception
msgbox("发送失败:" & ex.message)
End Try