HELP: Sending mail (Error)

V

VB Programmer

I am trying to send a simple email through my ASP.NET website. This is how
I do it.
Try
System.Web.Mail.SmtpMail.Send("(e-mail address removed)",
"(e-mail address removed)", "test", "TESTING 123")
Catch ex As Exception
Response.Write(ex.ToString)
End Try
Exit Sub

I get this error:
"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 (0x80040220): The "SendUsing"
configuration value is invalid.

--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object
obj, String methodName, Object[] args)
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
--- End of inner exception stack trace ---
at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.CdoSysHelper.Send(String from, String to, String
subject, String messageText)
at System.Web.Mail.SmtpMail.Send(String from, String to, String subject,
String messageText)
at POWERWeb.TestCode.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\POWERWeb\TestCode.aspx.vb:line 36"

Any ideas? Thanks.
 
C

Cor

Hi VB programmer,

This sample I made once for someone from Polen.
wiadomosc=message

I hope this helps?

Cor

\\\
Dim wiadomosc As Web.Mail.MailMessage = New Web.Mail.MailMessage
Dim config As MailAttachment = New
MailAttachment("c:\test.txt")
wiadomosc.Attachments.Add(config)
wiadomosc.From = xxx@xxx
wiadomosc.To = xxx@xxx
wiadomosc.Subject = "..."
wiadomosc.Body = "..."
wiadomosc.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "xxxx.xxxx.xx"
System.Web.Mail.SmtpMail.Send(wiadomosc)
///
 
V

VB Programmer

I tried it and got the same error.

I used "localhost" as the SmtpServer. Is this the right thing to do? Is
the "Default SMTP Virtual Server" in ISM the only thing that needs to be
running? Any ideas?

Thanks.
 
C

Cor

Hi,

Do you have a IIS smtp mailserver running on that localhost.
If you have you also can than try 127.0.0.1

Cor
 
C

Chad Z. Hower aka Kudzu

Cor said:
Thanks that you tell me that

And you are sure that you can use LOCALHOST everywhere?

Anywhere that you want to use 127.0.0.1 - except on Win95 B which has a bug
with it, but you wont be running .net there anwyays.

But you still have to have a SMTP server running.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"


ELKNews - Get your free copy at http://www.atozedsoftware.com
 
C

Charlie@CBFC

I get same problem. Never been able to figure it out. If all else fails,
you can set SMTP property to your ISP's SMTP server. This is what I did.

Charlie
 
G

Guest

These codes are working without error message.. But I didn't get email.. Is that really working or not?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top