How to send email by jmail?
Private void sendmail_jmail ()
(/ / Use of a mailing jmail; need to add quote jmail.dll
/ / = New jmail.SMTPMailClass jmail.SMTPMailClass mail ();
Jmail.MessageClass msg = new jmail.MessageClass ();
Msg.From = this.tb_from.Text.Trim ();
Msg.AddRecipient (this.tb_to.Text.Trim (), "Gallon letter ","");
Msg.Body = this.tb_mailBody.Text.Trim ();
Msg.Subject = "jamil to est";
Msg.MailServerUserName = "E-mail user name";
Msg.MailServerPassWord = "E-mail password";
/ / Msg.AddAttachment (filename, false, "test / html ");// send attachments;
Msg.Send (this.tb_smtpserver.Text.Trim (), false);
Msg.Close ();
)
Private void receivemail_jmail ()
(/ / Jmail receive mail;
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 + +)
(
/ / Contents of the letter you can be;
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 ++)// Annex receiver
Att [j]. SaveToFile ( "c: \ \" + att [j]. Name);
)
Pm.Disconnect ();
)
———————————– Finished ————– ——————-
Note:
Attention to the interface, such as conversion, otherwise unable to receive mail, and attachments;
In the reception for an initial cycle (Annex 0), I do not know why; it is not a ladybug;
Order, if you have jmail.dll in use;
Can be used. Net tools Tlbimp jmail.dll / out: newjmail.dll / namespace: jmail packaging;
Over








0 Comments to “How to send email by jmail?”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.