|
|
|
|
|
|
|
How to create HTML emails featuring barcode images with System.Net.Mail classes in ASP.NET (VB.NET and C#)
Prerequisites
- Neodynamic Barcode Professional 3.0 (or greater) for ASP.NET (WebControl)
- Microsoft .NET Framework 2.0 (or greater)
- Microsoft Visual Studio 2005, Visual Web Developer Express Edition or Microsoft Expression Web
|
In the following Step-By-Step Guide we're going to create a simple ASP.NET web page which lets you to generate and send HTML emails featuring barcode images (some useful scenarios may involve any kind of barcode tickets, newsletters, invitations, and so on) created by Barcode Professional for ASP.NET and the System.Net.Mail classes.
Follow these steps:
- Open your preferred ASP.NET Editor (Microsoft Visual Studio 2005, Visual Web Developer Express Edition or Microsoft Expression Web) and create an ASP.NET website and add a blank page.
- Add a reference to Neodynamic.WebControls.BarcodeProfessional.dll assembly.
- Design the created webform so it looks like the following figure. Add a TextBox and a Button control.
- In the class file of the webform write the following private method called GetBarcodeImage() which will generate a barcode image encoding a random value by using Barcode Professional so it can be embedded into the HTML email.
Visual Basic .NET
Visual C# .NET
- Now code the button's click event. In the button's click event procedure we are going to generate the HTML email by using System.Net.Mail classes embedding the barcode image generated by the aforementioned private method.
Visual Basic .NET
Visual C# .NET
- That's it. Build your project and test it. IMPORTANT: Remember to specify a VALID "FROM" EMAIL ACCOUNT AS WELL AS A VALID SMTP SERVER in the code above.
You should get something like the following figure.
- After you specify a valid email address and click on "Send Barcode Ticket" a HTML email with barcode image will be send to you.
If you need more information or assistance, please contact our
.
|
|
|
|
|
|
|