Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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


 
Old May 19th, 2004, 08:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,110
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.


 
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

 
Old May 20th, 2004, 07:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is SMTP running on your server?

 
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.



 
Old May 24th, 2004, 08:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,110
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.

 
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.