System.Web.Mail.Smtp namespace



Trying to send an eMail frommy vb.net App.
Is there anybody out there that has successfully done this?
I am having major problems and need a step by step guide into the world of
system.web and IIS. The reading I have done(alot) has been pretty useless in
helping me understand the various bits required.

The error I get is: On a pc running win2k with IIS and Lotus Notes
System.Runtime.InteropServices.SEHException: External component has thrown
an Exception
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail/SmtpMail.Send(MailMessage message)
at MyAppName.MyFormName.MyMailingFunction

The error I get is: On a DEV(not networked) pc running winXP with with IIS
but without Lotus Notes

System.Web.HttpException: Could not access 'CDO.Message' object ---->
System.Reflection.TargetInvocationexception: Exception has been thrown by
the target of an invocation --->
System.Runtime.InteropServices.COMException(0x80040213): The transport
failed to connect to the server



CODE:::
Imports System.Web.Mail

Private Sub Mail1()
Dim myMessage As New MailMessage
Dim myMailServer As SmtpMail

myMessage.BodyFormat = MailFormat.Text 'or MailFormat.Html
myMessage.Priority = MailPriority.Normal ', High, or Low
myMessage.From = "marc.mcguckian@xxxxxxxxxxxxxxxx" 'From Address
myMessage.To = "marc.mcguckian@xxxxxxxxxxxxxxxx" 'To Address
'myMessage.Cc = "someoneelse@xxxxxxxxxxxxxx" 'Send a Carbon-Copy
'myMessage.Bcc = "someone@xxxxxxxxxxxxxx" 'Send a Blind Carbon-Copy
myMessage.Subject = "VB.NET E-mail Test"
'Below is the Body of the E-mail I did it this way to show that this
property
'can be treated as a string.
myMessage.Body = "This is a test of a Windows E-mailer<BR>" & vbCrLf
myMessage.Body &= "<font color=blue>TEST</font><br>" & vbCrLf & _
"<font color=red>TEST</font><br>" & vbCrLf

'Add an attachment to your Email. Attachments in Windows
applications are touchy.
'In the project it will throw an error if you don’t have the file in
the
'Solution Explorer. But just running the .exe it seems to be fine
with any file.
'Make sure file has full pathing otherwise you will definitely get
an error.
'myMessage.Attachments.Add(New System.Web.Mail.MailAttachment(File))

'10.2.0.4
'cavan02.quinn-direct.com)

'myMailServer.SmtpServer = "cavan02.quinn-direct.com" 'This is your
mail server
myMailServer.SmtpServer = "cn2k-03321.quinn-direct.com" 'This is
your mail server
Try
myMailServer.Send(myMessage)
Catch ex As Exception
MessageBox.Show(ex.ToString)
MessageBox.Show(ex.InnerException.ToString)
MessageBox.Show(ex.Source)
End Try

myMessage = Nothing
End Sub
.



Relevant Pages

  • Re: System.Web.Mail.Smtp namespace
    ... > The error I get is: On a pc running win2k with IIS and Lotus Notes ... > System.Reflection.TargetInvocationexception: ... > Private Sub Mail1() ... > your mail server ...
    (microsoft.public.dotnet.languages.vb)
  • Printing problem using - System.Diagnostics.ProcessStartInfo startInfo
    ... Using IIS 6.0 - Windows 2003 Server ... I am attempting to print an Adobe PDF document from a web page ... Base Exception Is System.ComponentModel.Win32Exception: Access is ...
    (microsoft.public.dotnet.languages.csharp)
  • An exercise to exploit IIS ISAPI filter
    ... I began curious how they manage to reproduce around the Internet ... The filter is used by IIS on Window ... Service Manager,choose properties, then ISAPI Filter and from here you can ... An Access violation exception happen when IIS filter handling the ...
    (Vuln-Dev)
  • Re: security header is not present in the incoming message
    ... I get this exception every time I run my service thru ordinary IIS ... My client is simple ASP.NET Web Site ... Security requirements are not satisfied because the security header is ...
    (microsoft.public.dotnet.security)
  • Re: ASP.NET auf IIS
    ... Failed to access IIS metabase. ... Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed ... siteID, VirtualPath path) +3500410 ...
    (microsoft.public.de.inetserver.iis)