Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 18th, 2004, 10:10 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default email sending



Hi i am doing application in asp.net

I want to send mail .I am sending mail using cdonts.When i execute my page its not giving any erroe message but i am not receiving any mail.Can i send mail to any domains(like yahoo ect) using cdonts?My code is below.Pl help me.


Imports System.Web.Mail
Imports CDONTS.NewMailClass

    Dim ObjMail As CDONTS.NewMail


        ObjMail.From = vfrom
        ObjMail.To = vto
        ObjMail.Subject = "From cdonts"
        ObjMail.Body = "test"
        ObjMail.Send()
        ObjMail = Nothing
        Response.Write("mail sent")


when i try to send using smtp i am getting below error

System.Runtime.InteropServices.COMException: The transport failed to connect to the server

my code is

     Dim objMail As New MailMessage
        objMail.From = vfrom
        objMail.To = "xxx@yahoo.com"
        objMail.Priority = MailPriority.High
        objMail.Subject = "from smpt"
        objMail.Body = "This is my first email sent via "
        SmtpMail.SmtpServer = "SMTP.email.dupont.com"
        SmtpMail.Send(objMail)

thanks


Reply With Quote
  #2 (permalink)  
Old May 19th, 2004, 08:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Don't use CDONTS with asp.net or a Win XP machine... try this:

Dim mailObj As New MailMessage
    mailObj.From = "from@mysite.com"
    mailObj.To = "to@whoever.com"
    mailObj.Subject = "Contact Us"
    mailObj.Body = "<b>Request from </b>" & txtFirstName.Text & " " & txtLastName.Text & "<br>"
    mailObj.Body &= "<b>Phone -</b> " & txtPhone.Text & "<br>"
    mailObj.Body &= "<b>Email -</b> " & txtEmail.Text & "<br><br>"
    mailObj.Body &= "<b>Comments -</b> " & txtComments.Text & ""
    mailObj.BodyFormat = MailFormat.Html
    SmtpMail.SmtpServer = "servername"
    SmtpMail.Send(mailObj)

You will also need to import System.Web.Mail.


Reply With Quote
  #3 (permalink)  
Old May 20th, 2004, 01:30 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi
Thanks for your response.I tried same code but i am getting this error

System.Runtime.InteropServices.COMException: The transport failed to connect to the server.

Do i need to do any settings in IIS side or SMTP Virtual Server menu in IIS?
Pl advice me

thanks

Reply With Quote
  #4 (permalink)  
Old May 20th, 2004, 07:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is SMTP running on your server?

Reply With Quote
  #5 (permalink)  
Old May 23rd, 2004, 08:17 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No its running in another server but i dont know where it reside.i know only smtp server name only.



Reply With Quote
  #6 (permalink)  
Old May 24th, 2004, 08:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You need to know the name of the SMTP server and it also has to be on your network.

Reply With Quote
  #7 (permalink)  
Old June 26th, 2004, 06:59 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to xewei
Default

hello,ervery one.

I think your stmp server may be using smtp validate.

see below codes:

MailMessage mail = new MailMessage();
mail.To = fRecipients;
mail.From = fSender;
mail.Subject = fMailSubject;
mail.Body = fMailBody;
mail.Priority = MailPriority.Normal;
mail.BodyFormat = MailFormat.Html;
//================================================== =====================================
//smtp SMTPAuthenticate code
//================================================== =====================================
mail.Fields.Add(CdoConfiguration.cdoSMTPAuthentica te, "1");
mail.Fields.Add(CdoConfiguration.cdoSendUserName, fSendUsername); //username
mail.Fields.Add(CdoConfiguration.cdoSendPassword, fSendPassword); //password
mail.Fields.Add(CdoConfiguration.cdoSMTPServerPort ,fSmtpPort); //SMTP¶Ë¿Ú
SmtpMail.SmtpServer = fSmtpServer; //smtp server
//================================================== =====================================
SmtpMail.Send(mail);

this code had be tested.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending EMAIL charleshua BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 16 September 3rd, 2008 12:27 AM
Sending email ironchef Pro JSP 3 February 17th, 2008 11:38 PM
Sending email maitias C# 2005 2 February 17th, 2006 11:24 AM
sending email keyvanjan Classic ASP Components 1 May 9th, 2005 05:56 PM



All times are GMT -4. The time now is 02:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.