how to send email by jmail?
2004-08-31 19:13
330 查看
private void sendmail_jmail()
{//使用jmail进行邮件发送;需要添加引用jmail.dll
//jmail.SMTPMailClass mail = new jmail.SMTPMailClass();
jmail.MessageClass msg = new jmail.MessageClass();
msg.From = this.tb_from.Text.Trim();
msg.AddRecipient(this.tb_to.Text.Trim()," Gallon来信","");
msg.Body= this.tb_mailBody.Text.Trim();
msg.Subject = " jamil to est";
msg.MailServerUserName = "邮箱用户名";
msg.MailServerPassWord = "邮箱密码";
//msg.AddAttachment(filename, false,"test/html");//发送附件;
msg.Send(this.tb_smtpserver.Text.Trim(), false);
msg.Close();
}
private void receivemail_jmail()
{//jmail接收邮件;
jmail.POP3Class pm = new jmail.POP3Class();
pm.Connect(this.mail_name.Text.Trim(),this.mail_password.Text.Trim(),this.mail_pop3server.Text.Trim(),110);
pm.Logging = true;
pm.DownloadMessages();
jmail.MessagesClass msgs = (jmail.MessagesClass)pm.Messages;
for(int i=1;i<msgs.Count;i++)
{
//你的信件内容可以这样获得;
this.mail_sendUser.Text = msgs[i].From;
this.mail_subject.Text = msgs[i].Subject;
this.mail_receiveList.Text = msgs[i].RecipientsString;
this.mail_body.Text = msgs[i].Body;//
jmail.AttachmentsClass att = (jmail.AttachmentsClass)msgs[i].Attachments;
for(int j=0;j<att.Count;j++)//附件接收
att[j].SaveToFile("c://"+att[j].Name);
}
pm.Disconnect();
}
-----------------------------------finished---------------------------------
提示:
注意接口,类的转换,否则无法接收邮件,和附件;
在接收时循环起始为1(附件为0);不知是何故;不会是个ladybug吧;
令外,如果你的jmail.dll在使用中 有问题;
可以用.net的工具 Tlbimp jmail.dll /out:newjmail.dll /namespace:jmail进行包装;
over
{//使用jmail进行邮件发送;需要添加引用jmail.dll
//jmail.SMTPMailClass mail = new jmail.SMTPMailClass();
jmail.MessageClass msg = new jmail.MessageClass();
msg.From = this.tb_from.Text.Trim();
msg.AddRecipient(this.tb_to.Text.Trim()," Gallon来信","");
msg.Body= this.tb_mailBody.Text.Trim();
msg.Subject = " jamil to est";
msg.MailServerUserName = "邮箱用户名";
msg.MailServerPassWord = "邮箱密码";
//msg.AddAttachment(filename, false,"test/html");//发送附件;
msg.Send(this.tb_smtpserver.Text.Trim(), false);
msg.Close();
}
private void receivemail_jmail()
{//jmail接收邮件;
jmail.POP3Class pm = new jmail.POP3Class();
pm.Connect(this.mail_name.Text.Trim(),this.mail_password.Text.Trim(),this.mail_pop3server.Text.Trim(),110);
pm.Logging = true;
pm.DownloadMessages();
jmail.MessagesClass msgs = (jmail.MessagesClass)pm.Messages;
for(int i=1;i<msgs.Count;i++)
{
//你的信件内容可以这样获得;
this.mail_sendUser.Text = msgs[i].From;
this.mail_subject.Text = msgs[i].Subject;
this.mail_receiveList.Text = msgs[i].RecipientsString;
this.mail_body.Text = msgs[i].Body;//
jmail.AttachmentsClass att = (jmail.AttachmentsClass)msgs[i].Attachments;
for(int j=0;j<att.Count;j++)//附件接收
att[j].SaveToFile("c://"+att[j].Name);
}
pm.Disconnect();
}
-----------------------------------finished---------------------------------
提示:
注意接口,类的转换,否则无法接收邮件,和附件;
在接收时循环起始为1(附件为0);不知是何故;不会是个ladybug吧;
令外,如果你的jmail.dll在使用中 有问题;
可以用.net的工具 Tlbimp jmail.dll /out:newjmail.dll /namespace:jmail进行包装;
over
相关文章推荐
- How to send mail by java mail in Android uiautomator testing?
- android: how to send email
- How to send mail by EMS - 如何实现邮件特快专递
- How to send Email using C#
- 创造应用英语环境学英语-how to send email
- How can I send an email by Java application?
- How to send email via vbs using cdo
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to send mail using VBScript & JMail - SourceCode - 如何用VBScript & JMail 发送邮件 - 源码
- How to send Email through external SMTP server on Ubuntu 14.04
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to build a COM to Send and Receive Multi File by ATL
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- How to send mail using any email account through Foxmail ? - Foxmail 6 漏洞,如何通过 Foxmail 用任意邮件账号发送邮件?
- How to Use git send-email
- How to send gmail by Indy (TIdSMTP)?
- How to send an email from oracle workflow process using an AdHocRole?
- how to send email
- Salesforce: How to Send Email with Default Template?
- how to solve the problem which is the imail software can not send email in wan,but can send email in lan.