SMTP Email problems

  • Thread starter Thread starter Poppy
  • Start date Start date
P

Poppy

The following line of code :
SmtpMail.Send(objEmail)

Produces this error :
"System.Runtime.InteropServices.COMException: Unspecified
error"

Can anyone help ?

I have included "Imports System.Web.Mail" at the top of my
code behind page and intelisence reveals all appropriate
properties and methods.
 
Hi Poppy,
I think the simplest thing to find it is to add a try, catch end try block.
I would in this situation put an extra label on my webform and then:
\\\
Dim objMail As New MailMessage()
..
..
..

Try
SmtpMail.Send(objMail)
extralabel = "mail is send"
Catch exp As Exception
extralabel = "A problem occurred: " & exp.Message
End Try
///
Your mail is not send, but you get probably some more information.
Just a try,
Cor
 
Hi Poppy,

Here's a few lines of code that works just fine. One of the things you
might want to investigate is if the .from address is valid and working
properly and also check the smtpmail.smtpserver address and working status:
Dim msg As New MailMessage()

msg.To = "(e-mail address removed)"

msg.From = "(e-mail address removed)"

msg.Subject = "test subject"

msg.Body = "this is the test info"

Dim astring1 As String = "c:\my documents\wzo letter.doc"

msg.Attachments.Add(New MailAttachment(astring1))

Dim astring2 As String = "c:\my documents\visual basic notes.doc"

msg.Attachments.Add(New MailAttachment(astring2))

msg.Cc = "(e-mail address removed)"

SmtpMail.SmtpServer = "smtp.registeredsite.com"

Try

SmtpMail.Send(msg)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger
 
Bernie,
Not on a code behind page from a webform I think.
The messagebox will throw an error as well.
Cor
 
Hi Poppy, could you please post your code that initializes the MailMessage
class?

Thanks.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
 
Back
Top