Hi there, This is what I have understood and done so far, To send an email out I need a SMTP server, and it makes connection to the destination machine on port 25, and IIS on WinXP has Default SMTP Virtual Server. And I have read many many discussions on how
to configure that SMTP server and code given in VB and C#, like this link, for example, http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=268037. I've tried the configurations with the SMTP server and the code and the cable modem port settings, so
I'm almost sure there is nothing more to that, so there must be something not right. The error message I get is very popular, "The "SendUsing" configuration value is invalid. System.Runtime.InteropServices.COMException: The "SendUsing" configuration value
is invalid. " What I don't understand is, to send email, we need 2 parties, the sender (me@email.com) to reciever (you@email.com), so what exactly is my email address if I'm testing my ASP.NET app at home, I use a cable modem and the online service is provided
by Comcast? How can I have an email address with the Default SMTP Virtual Server in IIS? Also, after the reciever recieves the mail and replies, how do I recieve the reply? What I'm tring to do is just to send a message to myself on hotmail.com in my app.
I tried using my own hotmail or Comcast(my ISP) email address as both sender and reciever, they didn't work. Could someone please help? Thank you very much! Ray.
I don't know why you are getting that error. The default SMTP server in IIS does not validate email addresses, so you can put anything you want in the "From" line; it will not affect the delivery of the message (unless the domain you claim to be from has been
blocked). Check out the free POP3 client from SoftArtisans; the code is open source, and you can learn a lot about sending and receiving mail by studying it. AutoFed
Thanks AutoFed, Here is my code, private void submitButton_Click(object sender, System.EventArgs e) { MailMessage mailMsg = new MailMessage(); mailMsg.From = "ruiray@hotmail.com"; mailMsg.To = "ruiray@hotmail.com"; mailMsg.Subject = "Subject: Testing"; mailMsg.Body
= "testing mail"; mailMsg.BodyFormat = MailFormat.Text; SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mailMsg); } ---------------------------------------------------------- Here is how I configured the local SMTP Server, 1. right-click the Default SMTP
Virtual Server node and choose Properties. 2. In the Access tab, click "Connection". 3. Select "Only the list below", click Add and add the IP 127.0.0.1. Close the Connection dialog box. 4. Click "Relay" and repeat Step 3 to allow only localhost to relay through
this server. ---------------------------------------------------------- Here is my error message again, The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review
the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid. ----------------------------------------------------------
Am I missing something here? Thanks! Ray.
Autofed is right, if you only use the local loopback IP, it will only allow the server to relay mail from an application hosted on the server, not another machine. If you are testing on a dev machine your mail will not go. You can test whether or not the SMTP
server is relaying mail properly by telneting to port 25 on the server. IMPORTANT:
You need to do this from the server, not remotely from another machine. Start>Run>Type:
telnet yourserver 25 Type: helo this will return Hello and the server ip or server name Next type:
mail from: should return "Sender Ok" Next type: rcpt to: should return "Recipient Ok" If this returns as listed above, your SMTP server is relaying mail properly. Keep in mind that when you telnet to port 25 on the server, you will not see the
commands as you type. So, 1. Check that SMTP Relay is functioning. 2. Check to see if the machine that is hosting the application has rights to relay mail through the SMTP server. 3. Check your code.
Thanks guys, I'm doing everything on one machine. I undid the SMTP configuration, I deleted 127.0.0.1 and left the list empty, and I chose "All except the list below" for both "Connection" and "Relay". I restarted SMTP server, then I tried my code, still didn't
work. After that I tried, "telnet localhost 25", and it responded correctly; then "helo" it returned "hello". However, I tried "mail from:" and "mail from:" all these returned "501 5.5.4 Invalid Address", so exactly what is my email address or what is the
correct address to type in for this test? And, in general how is an email address formed or given? Thanks! Ray.
System.Web.Mail relies on CDO being installed and working on your server. You can test CDO by saving the following code to a .vbs file, then executing the file. Replace the From and To addresses with valid addresses for your site. If this script successfully
sends mail, then the problem is somewhere in System.Web.Mail. If this script reports an error or doesn't send mail, then either your mail server isn't working properly, or CDO is not working properly.
Thank you all, experts! It worked. How did it work? I have no idea, - I undid all configuration to SMTP server(weird, why did a lot of the other messages gave out instruction on how to configure the SMTP server?) . - Then I restarted my PC(this is the only
thing I haven't tried before). - I left my code untouched. - I recieve all messages in my hotmail.com account (in junk mail folder though). - Also mharder your CDO test code also worked, thanks. Till next question, I thank everyone very much for helping out!
Ray.
ruiray@hotma...
Member
261 Points
58 Posts
Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 14, 2003 12:04 AM|LINK
autofed
Participant
1789 Points
357 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 14, 2003 02:41 AM|LINK
ruiray@hotma...
Member
261 Points
58 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 15, 2003 01:37 AM|LINK
autofed
Participant
1789 Points
357 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 15, 2003 03:11 AM|LINK
PD_Goss
Contributor
2310 Points
460 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 15, 2003 10:25 AM|LINK
ruiray@hotma...
Member
261 Points
58 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 15, 2003 05:50 PM|LINK
mharder
Contributor
4567 Points
917 Posts
Microsoft
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 15, 2003 06:04 PM|LINK
Set oMessage = CreateObject("CDO.Message") oMessage.From = "user@host.com" oMessage.To = "user@host.com" oMessage.Subject = "Test CDO" oMessage.TextBody = "Test CDO" oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" oMessage.Configuration.Fields.Update oMessage.Send Set oMessage=NothingThis posting is provided "AS IS" with no warranties, and confers no rights.
ruiray@hotma...
Member
261 Points
58 Posts
Re: Exactly what does it take to send and recieve emails with my ASP.NET application?
Aug 16, 2003 03:25 AM|LINK