c# print barcode zebra printer Lesson 1: Creating an E-mail Message in VB.NET

Drawer Quick Response Code in VB.NET Lesson 1: Creating an E-mail Message

Lesson 1: Creating an E-mail Message
Quick Response Code Printer In Visual Basic .NET
Using Barcode generation for .NET Control to generate, create Denso QR Bar Code image in Visual Studio .NET applications.
www.OnBarcode.com
Recognizing QR Code In VB.NET
Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
How to Create a MailMessage Object
Barcode Drawer In VB.NET
Using Barcode generator for VS .NET Control to generate, create barcode image in .NET framework applications.
www.OnBarcode.com
Decoding Bar Code In Visual Basic .NET
Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
The MailMessage object has four different constructors that allow you to create a blank MailMessage, specify both the sender and recipient, or specify the sender, recipient, subject, and message body. If you are creating a simple message with a single recipient, you can do the bulk of the work in the MailMessage constructor, as follows:
QR Code Maker In C#.NET
Using Barcode printer for VS .NET Control to generate, create Quick Response Code image in VS .NET applications.
www.OnBarcode.com
QR Code Creation In .NET
Using Barcode printer for ASP.NET Control to generate, create QR Code image in ASP.NET applications.
www.OnBarcode.com
' VB Dim m As MailMessage = New MailMessage _ ("jane@contoso.com", _ "ben@contoso.com", _ "Quarterly data report.", _ "See the attached spreadsheet.") // C# MailMessage m = new MailMessage ("jane@contoso.com", "ben@contoso.com", "Quarterly data report.", "See the attached spreadsheet.");
Print QR Code In .NET
Using Barcode drawer for .NET framework Control to generate, create Denso QR Bar Code image in VS .NET applications.
www.OnBarcode.com
UCC - 12 Creation In Visual Basic .NET
Using Barcode maker for .NET framework Control to generate, create UPC-A Supplement 2 image in Visual Studio .NET applications.
www.OnBarcode.com
NOTE
Print Code-128 In VB.NET
Using Barcode generator for Visual Studio .NET Control to generate, create Code 128B image in VS .NET applications.
www.OnBarcode.com
Encode Data Matrix In VB.NET
Using Barcode drawer for .NET framework Control to generate, create Data Matrix ECC200 image in .NET applications.
www.OnBarcode.com
Sending Quick Messages
Linear Barcode Generation In VB.NET
Using Barcode maker for VS .NET Control to generate, create Linear 1D Barcode image in .NET framework applications.
www.OnBarcode.com
Create ISSN In Visual Basic .NET
Using Barcode generator for VS .NET Control to generate, create ISSN - 10 image in .NET applications.
www.OnBarcode.com
You can also use an overload of the SmtpClient.Send method to send an e-mail without creating a MailMessage object. SmtpClient is described in Lesson 2.
Bar Code Drawer In Java
Using Barcode generator for Java Control to generate, create barcode image in Java applications.
www.OnBarcode.com
GS1 128 Drawer In Java
Using Barcode creation for Java Control to generate, create UCC.EAN - 128 image in Java applications.
www.OnBarcode.com
You can specify the sender and the recipient as either a string or MailAddress object. The MailAddress object allows you to specify an e-mail address, a display name, and an encoding type, as the following code sample demonstrates:
GS1 - 13 Maker In Java
Using Barcode printer for BIRT reports Control to generate, create EAN-13 Supplement 5 image in Eclipse BIRT applications.
www.OnBarcode.com
Recognizing EAN13 In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
' VB Dim m As MailMessage = New MailMessage _ (New MailAddress("lance@contoso.com", "Lance Tucker"), _ New MailAddress("ben@contoso.com", "Ben Miller")) // C# MailMessage m = new MailMessage (new MailAddress("lance@contoso.com", "Lance Tucker"), new MailAddress("ben@contoso.com", "Ben Miller"));
Barcode Encoder In Java
Using Barcode printer for Eclipse BIRT Control to generate, create barcode image in Eclipse BIRT applications.
www.OnBarcode.com
Generate Bar Code In .NET Framework
Using Barcode creation for ASP.NET Control to generate, create barcode image in ASP.NET applications.
www.OnBarcode.com
NOTE
Quick Response Code Generation In None
Using Barcode creator for Font Control to generate, create QR Code ISO/IEC18004 image in Font applications.
www.OnBarcode.com
PDF 417 Printer In Java
Using Barcode generator for BIRT reports Control to generate, create PDF417 image in BIRT reports applications.
www.OnBarcode.com
Encoding Types
Specifying the encoding type for e-mail addresses is rarely necessary.
If you need to specify multiple recipients, use the blank MailMessage constructor. Then add MailAddress objects to the MailMessage.To property (which is of the
15
Mail
MailAddressCollection type) and specify MailMessage.From, MailMessage.Subject, and MailMessage.Body, as follows:
' VB Dim m As MailMessage = New MailMessage() m.From = New MailAddress("lance@contoso.com", "Lance Tucker") m.To.Add(New MailAddress("james@contoso.com", "James van Eaton")) m.To.Add(New MailAddress("ben@contoso.com", "Ben Miller")) m.To.Add(New MailAddress("burke@contoso.com", "Burke Fewel")) m.Subject = "Quarterly data report." m.Body = "See the attached spreadsheet." // C# MailMessage m = new MailMessage(); m.From = new MailAddress("lance@contoso.com", "Lance Tucker"); m.To.Add(new MailAddress("james@contoso.com", "James van Eaton")); m.To.Add(new MailAddress("ben@contoso.com", "Ben Miller")); m.To.Add(new MailAddress("burke@contoso.com", "Burke Fewel")); m.Subject = "Quarterly data report."; m.Body = "See the attached spreadsheet.";
In addition, you can add recipients to the MailMessage.Cc and MailMessage.Bcc properties in exactly the same way as you would add recipients to MailMessage.From. Recipients specified with MailMessage.Cc receive the message, and their names show up on the CC: line of the e-mail, which is visible to all recipients. Recipients specified with MailMessage.Bcc receive the message, but their names are not visible to other recipients. BCC stands for blind carbon copy, a term that originated when people made duplicates of typed paper memos using carbon paper.
NOTE
The Risk of Using BCC
Instead of using BCC, you should send a separate copy of your message to each recipient that you want to receive a blind copy. The problem with BCC is that spam filters frequently block messages that do not have the recipient s e-mail address in the To header. Therefore, if you use BCC, the message is more likely to be filtered.
MailMessage has the following less frequently used properties: Instructs the SMTP server to send a message to the address specified in MailMessage.From if a message is delayed, fails, or is successfully delivered or relayed to another server. The enumeration is of type DeliveryNotificationOptions, and the values are OnSuccess, OnFailure, Delay, None, and Never.
DeliveryNotificationOptions
The e-mail address to which replies will be sent. Because the .NET Framework does not act as an e-mail client, and therefore your application will not typically be receiving e-mail, in most cases you should simply set MailMessage .From to the address that should receive replies instead of using ReplyTo.
ReplyTo
Lesson 1: Creating an E-mail Message
The priority of the message. This does not in any way affect how the .NET Framework or the mail server handles the message. However, the priority might be visible in the recipient s e-mail client. The priority is also useful for filtering automatically generated e-mail based on the priority of the event that initiated the e-mail. This enumeration is of type MailPriority and can have values of Normal, High, and Low.
Copyright © OnBarcode.com . All rights reserved.