In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to understand the two methods of VB.NET sending email, which may not be well understood by many people. In order to make you understand better, the editor summed up the following contents for you. I hope you can get something from this article.
VB.NET is very powerful and has a standard program interface, which can help programmers improve their development efficiency. It can support various features of the class. So today we will make a detailed interpretation of the skills of using this language through the understanding of the way VB.NET sends e-mail.
One of the implementation methods of sending mail by VB.NET is to use the sending provided by outLook
For example, the U8 software I have seen is produced and manufactured (demo version), in which the mail function is by calling the ActiveX component of outLook
Advantages: easy to develop
Disadvantages: relying on outlook components, SMTP mail service
The code for sending the message is as follows:
The following is a reference clip:
Private Sub Send ()
Dim outObj As New
Outlook.Application ()
Dim Item As Outlook.
MailItemClass
Item = outObj.CreateItem (0)
Item.To = "lihonggen0@163.com"
Item.Subject = "hello"
Item.Body = "hell"
Item.Attachments.Add
("C:\ abc.txt")
Item.Send ()
End Sub
The second implementation method of sending mail in VB.NET. WEB development, referencing the System.Web.Mail class in asp.net
Analysis of basic Concepts of VB.NET assignment statement
Detailed explanation of the specific application method of VB.NET declaration statement
Sample Code interpretation of VB.NET executable statement
Detailed explanation of the steps related to the creation process of VB.NET
How to operate the VB.NET stream correctly
The System.Web.Mail namespace contains classes that allow you to construct and send messages using the CDOSYS (Collaborative data object) message component of Windows 2000. Mail messages are delivered through the SMTP mail service built into Microsoft Windows 2000 or any SMTP server. Classes in this namespace can be found in asp.Net or any managed application
MailAttachment provides properties and methods for constructing e-mail attachments.
MailMessage provides properties and methods for constructing e-mail messages.
SmtpMail provides properties and methods for sending messages using the Collaborative data object (CDOSYS) message component of Windows 2000.
Messages can be delivered through the SMTP mail service built into Microsoft Windows 2000 or any SMTP server. Types in the System.Web.Mail namespace can be used in ASP.Net or any managed application.
Smtp server settings, now some free mail providers no longer provide Smtp services for all mail. When sending mail, you need to verify user information and consider Smtp user authentication.
If the Smtp server is on the local computer, and the sending speed is very fast, basically don't worry. If it is not a local server, then do not use this to send too much. First, it is a problem of speed, and second, it sends too many emails. The Smtp server may think that it is spam and refuse service.
The code for VB.NET to send an email is as follows:
The following is a reference clip:
Private Sub Button1_Click (ByVal
Sender As System.Object, ByVal e
As System.EventArgs) Handles
Button1.Click
Dim mailObj As New MailMessage ()
Dim smtp As SmtpMail
'define the name of the SMTP server
Smtp.SmtpServer = "smtp.XXX.com"
'define the sending address of the message
MailObj.From = "lihonggen@XXX.com"
'define the receiving address of the message
MailObj.To = "AAA@XXX.com"
'define the secret delivery address of the message
MailObj.Bcc= "aa@sina.com"
'define the CC address of the message
MailObj.Cc = "aaa@sina.com"
'define the subject of the message
MailObj.Subject = "subject"
'define the body of the message
MailObj.Body = "message body!"
'The mail is sent in HTML format
MailObj.BodyFormat = MailFormat.Html
'define the limited level of the message, which is set to high here
MailObj.Priority = MailPriority.High
'attach an attachment to the sent message
MailObj.Attachments.Add (New
MailAttachment ("c:\ aa.doc"))
SmTp.Send (mailObj)
End Sub
Summary: the choice of VB.NET to send mail depends on the purpose and needs of the program.
After reading the above, do you have any further understanding of how to understand the two ways of sending e-mail by VB.NET? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.