By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,682 Members | 1,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,682 IT Pros & Developers. It's quick & easy.

SMTP Email problems

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Cor
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
Nov 20 '05 #2

P: n/a
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 = "be*****@optonline.net"

msg.From = "be*****@cherwellinc.com"

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 = "we*******@cherwellinc.com"

SmtpMail.SmtpServer = "smtp.registeredsite.com"

Try

SmtpMail.Send(msg)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger

"Poppy" <pa**********@themedialounge.com> wrote in message
news:06****************************@phx.gbl...
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.

Nov 20 '05 #3

P: n/a
Cor
Bernie,
Not on a code behind page from a webform I think.
The messagebox will throw an error as well.
Cor
Nov 20 '05 #4

P: n/a
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
"Poppy" <pa**********@themedialounge.com> wrote in message
news:06****************************@phx.gbl...
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.

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.