Jamil发送邮件的具体用法:
首先,我们要先下载Jamil.dll的组件,然后添加引用using jmail,然后再本机或者服务器上注册一下
将jmail.dll拷贝到服务器的system32目录下,开始-运行-cmd-输入regsvr32 jmail.dll,注册成功,然后写代码
代码如下(方法)
代码如下:
using jmail;
protected void sendMail(String sender, String senderMail, String receiver, String subject, String content)
{
jmail.MessageClass jmMessage = new jmail.MessageClass();
//设置字符集
jmMessage.Charset = "gb2312";
//发件人邮箱地址
jmMessage.From = senderMail;
//发件人姓名
jmMessage.FromName = sender;
//设置主题
jmMessage.Subject = subject;
//设置内容
jmMessage.Body = content;
// 设置收件人邮箱
jmMessage.AddRecipient(receiver, "", "");
// 设置登陆邮箱的用户名和密码
jmMessage.MailServerUserName = "ss";
jmMessage.MailServerPassWord = "ss";
//设置smtp服务器地址
if (jmMessage.Send("smtp.163.com", false))
{
Response.Write("<script>alert('发送成功')</script>");
}
else
Response.Write("<script>alert('www.Vevb.com发送失败')</script>");
}
上面就是Jmail的具体用法!
我想放一个附件如下
代码如下:
jmail.AddAttachment(“c:autoexec.bat”)
jmail.AddAttachment(“myImage.gif”,TRUE)
结果出现如下错误
This is a multipart message in MIME format. —-NEXT_BM_AEB3968967D044DC9E208D04088C60B4 Content-Type: text/html; charset=”GB2312″ Content-Transfer-Encoding: Quoted-Printable sdfdd —-NEXT_BM_AEB3968967D044DC9E208D04088C60B4 Content-Type: application/octet-stream; name=”=?GB2312?Q?12d95384-576f-424f-bf15-f8e2397e2791=2EJPG?=” Content-Transfer-Encoding: base64 Content-Description: =?GB2312?Q?12d95384-576f-424f-bf15-f8e2397e2791=2EJPG?= Content-Disposition: inline; filename=”=?GB2312?Q?12d95384-576f-424f-bf15-f8e2397e2791=2EJPG?=” Content-ID:
新闻热点
疑难解答
图片精选