Hello,
I am trying to run your VB.NET samples by creating WebForm(s) with a button and executing the code on button click. I have included all the imports from RunExamples.vb but in several of the examples I am getting red underlines that the property or method is not found. Here are a couple of examples.
I want to be able to run these examples individually to decide if this solution is right for me, please help.
Thank you,
Faruk
1. client.SecurityOptions = SecurityOptions.None and Trace.WriteLine(ex.ToString() have red underlines:
Imports System.Diagnostics
Imports Aspose.Email.Mail
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Text
Imports Aspose.Email.Examples.VisualBasic.Email
Imports Aspose.Email.Examples.VisualBasic.Email.IMAP
Imports Aspose.Email.Examples.VisualBasic.Email.Knowledge.Base
Imports Aspose.Email.Examples.VisualBasic.Email.Outlook
Imports Aspose.Email.Examples.VisualBasic.Email.POP3
Imports Aspose.Email.Examples.VisualBasic.Email.Exchange
Imports Aspose.Email.Examples.VisualBasic.Email.SMTP
Imports Aspose.Email.Examples.VisualBasic.Email.Thunderbird
Public Class SendEmailUsingSMTP
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub SendEmail_Click(sender As Object, e As EventArgs) Handles SendEmail.Click
' Declare msg as MailMessage instance
Dim msg As New MailMessage()
' Create an instance of SmtpClient class
Dim client As New SmtpClient()
' Specify your mailing host server, Username, Password, Port # and Security option
client.Host = "mail.datascsgrp.com"
client.Username = "myemail"
client.Password = "mypassord"
client.Port = 587
'client.SecurityOptions = SecurityOptions.SSLExplicit
client.SecurityOptions = SecurityOptions.None
Try
' Client.Send will send this message
client.Send(msg)
Console.WriteLine("Message sent")
Catch ex As Exception
Trace.WriteLine(ex.ToString())
End Try
Console.WriteLine("Press enter to quit")
Console.Read()
End Sub
End Class
2. RunExamples.GetDataDir_Email() has a red underline:
Imports Aspose.Email
Imports Aspose.Email.Mail
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Text
Imports Aspose.Email.Examples.VisualBasic.Email
Imports Aspose.Email.Examples.VisualBasic.Email.IMAP
Imports Aspose.Email.Examples.VisualBasic.Email.Knowledge.Base
Imports Aspose.Email.Examples.VisualBasic.Email.Outlook
Imports Aspose.Email.Examples.VisualBasic.Email.POP3
Imports Aspose.Email.Examples.VisualBasic.Email.Exchange
Imports Aspose.Email.Examples.VisualBasic.Email.SMTP
Imports Aspose.Email.Examples.VisualBasic.Email.Thunderbird
Public Class ASPOSE_Create_Email
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub SendMail_Click(sender As Object, e As EventArgs) Handles SendMail.Click
' For complete examples and data files, please go to https://github.com/aspose-email/Aspose.Email-for-.NET
' The path to the File directory.
Dim dataDir As String = RunExamples.GetDataDir_Email()
' Create a new instance of MailMessage class
Dim message As New MailMessage()
' Set subject of the message, Html body and sender information
message.Subject = "New message created by Aspose.Email for .NET"
message.HtmlBody = "<b>This line is in bold.</b> <br/> <br/>" + "<font color=blue>This line is in blue color</font>"
message.From = New MailAddress("faruk.ansari@datascsgrp.com", "Faruk Ansari", False)
' Add TO recipients and Add CC recipients
message.[To].Add(New MailAddress("fansari@vitalsciences.com", "Faruk Ansari (VSI)", False))
message.[To].Add(New MailAddress("faruk.ansari@datascsgrp.com", "Faruk Ansari (DSG)", False))
message.CC.Add(New MailAddress("m3bmw@hotmail.com", "Faruk Ansari (HOTMAIL)", False))
message.CC.Add(New MailAddress("farukansari1117@gmail.com", "Faruk Ansari (GMAIL)", False))
' Save message in EML, EMLX, MSG and MHTML formats
message.Save(dataDir & Convert.ToString("Message_out.eml"), SaveOptions.DefaultEml)
message.Save(dataDir & Convert.ToString("Message_out.emlx"), SaveOptions.CreateSaveOptions(MailMessageSaveType.EmlxFormat))
message.Save(dataDir & Convert.ToString("Message_out.msg"), SaveOptions.DefaultMsgUnicode)
message.Save(dataDir & Convert.ToString("Message_out.mhtml"), SaveOptions.DefaultMhtml)
End Sub
End Class