Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2005

Tip: Looking for answers? Try searching our database.

Problems sending emails

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Srinivas - 26 Apr 2005 22:18 GMT
Hi,

I am using ASP.NET SmtpMail to send email using the following code

public void SendEmail(string From, string To, string Subject, StringBuilder
Message, string Attachment, string mailFormat)
{
   MailMessage mailMessage = new MailMessage ();
   mailMessage.From = From;
   mailMessage.To = To;
   mailMessage.Subject = Subject;
   mailMessage.Body = Message.ToString ();

   if(mailFormat == "T")
   {
       mailMessage.BodyFormat = MailFormat.Text;
   }
   else if(mailFormat == "H")
   {
       mailMessage.BodyFormat = MailFormat.Html;
   }

   SmtpMail.SmtpServer = "10.0.0.1";
   SmtpMail.Send (mailMessage);
}

This code executes fine without error. But the email goes and sits in the
"C:\Inetpub\mailroot\Queue" folder.
SMTP service is running and cdosys.dll and cdonts.dll are installed.

My computer is connected to the internet through a Speedtouch 545 ADSL
router. I got the "10.0.0.1" by doing the ipconfig at command prompt.

Can anyone please guide me in the right direction.

Thanks,

Srinivas
Alvin Bruney [MVP - ASP.NET] - 27 Apr 2005 03:28 GMT
replace the ipaddress with "localhost", that should fix it.

Signature

Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc

> Hi,
>
[quoted text clipped - 35 lines]
>
> Srinivas
Srinivas - 30 Apr 2005 09:23 GMT
Thanks a lot Alvin. I posted this message in aspnet, csharp groups also. You
are the only one to reply. Thanks once again.

I replaced the ipaddress with localhost and I recieved the following error
and inner exception.

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. --- 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)

Is being behind an ADSL router the cause for this error?

Regards,

Srinivas

> replace the ipaddress with "localhost", that should fix it.
>
[quoted text clipped - 37 lines]
> >
> > Srinivas

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.