Re: Mail sent through IIS virtual SMTP server not arriving
- From: "antonyliu2002@xxxxxxxxx" <antonyliu2002@xxxxxxxxx>
- Date: 4 Mar 2006 20:50:51 -0800
Hi, Juan,
I tried like you instructed, but I still cannot get it to work.
I also have
127.0.0.1 mydoman.com
in the hosts file under system32\drivers\etc\
In the code, I still have to say
SmtpMail.SmtpServer = "127.0.0.1"
If I don't, I get the typical "Cannot access CDO.Message" error.
The event viewer warning message still says that the destination domain
does not respond to a connection attempt from my smtp virtual server.
Juan T. Llibre wrote:
It's real simple.
Open the IIS Manager; scroll down to "Default SMTP Server";
click the "+" sign; select "Domains"; right-click "Domains"
and select "New" and then "Domain".
Select "alias", click "Next" and then write in
your domain name in the next dialog.
That's it!
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141517649.430262.29880@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hmm, but I really don't know how to setup a virtual domain for my smtp
server. I googled, but could not a good tutorial.
Juan T. Llibre wrote:
re:
As a matter of fact, I do have a domain name from dnsexit.com.
Not sure how to go about this.
If you have a domain name, you should setup a virtual domain
for the smtp server, and use your domain name as an alias.
You can also, as suggested before, create a virtual domain for your
machinename and map 127.0.0.1, in the hosts file, to your machinename.
For example, I have an smtp virtual domain for asp.net.do
and another virtual domain for my machine's name, and both work fine.
Use the IIS Manager to create your virtual domains for your smtp server.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141424173.849392.320860@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Juan,
As a matter of fact, I do have a domain name from dnsexit.com.
I tried allowing relay for my own IP, the dynamic one (which changes
once every long while) assigned by my ISP.
And then I would use
SmtpMail.SmtpServer = "70.225.171.219"
But then, I would get the typical "Could not access 'CDO.Message'
object" exception. It looks like that I won't get this exception only
if I use "127.0.0.1".
Not sure how to go about this. It's getting really really frustrating.
Juan T. Llibre wrote:
re:
So, it looks like that remote servers do not accept my mail.
If you are using 127.0.0.1 as your smtp name,
mail servers will usually reject mail sent from it.
They will also reject mail originating at single-name ( machinename ) sources.
The best thing to do is register a domain name ( it's quite cheap )
and assign it to your fixed IP.
If you don't have a fixed IP, there's services like www.zoneedit.com
which can provide you with a free dns pointer to your domain,
even if you only have a dynamic IP address instead of a fixed IP.
Zoneedit will also give you a free domain MX, so that you can receive
mail addressed to mail.yourdomain.com or yourdomain.com.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141420722.850336.185580@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
As a follow-up, I did Start>Run>eventvwr.msc, and clicked System.
I got a whole bunch of Warnings from source SMTPSVC like so:
Type Date Time Source Category Event User Computer
Warning 3/3/2006 3:02:13PM SMTPSVC None 4000 N/A jzgwxp
Warning 3/3/2006 1:40:23PM SMTPSVC None 4000 N/A jzgwxp
Warning 3/3/2006 1:25:51PM SMTPSVC None 4000 N/A jzgwxp
Warning 3/3/2006 1:12:17PM SMTPSVC None 4000 N/A jzgwxp
I right-clicked on one of them and viewed the properties. This is what
I saw:
Event Type: Warning
Event Source: smtpsvc
Event Category: None
Event ID: 4000
Date: 3/3/2006
Time: 3:02:13 PM
User: N/A
Computer: JZGWXP
Description:
Message delivery to the remote domain 'gmail.com' failed for the
following reason: The remote server did not respond to a connection
attempt.
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Data:
0000: d2 02 04 c0 Ò..À
So, it looks like that remote servers do not accept my mail.
Juan T. Llibre wrote:
Open the IIS Manager and check the properties for the smtp server.
In the Default SMTP Virtual Server's properties, in the "Access" tab, both
in the Connection Control and Relay dialogs, make sure that your local IP is assigned.
( In my case, it's 10.0.0.2... )
You may also need to modify your hosts file, to point 127.0.0.1 to your machine name.
( \WINDOWS\system32\drivers\etc\hosts )
Then, in your code, assign your machine name to the smtp client :
SmtpMail.SmtpServer = "YourMachineName";
SmtpMail.Send(mail);
This fixed the problem for me. I hope it does the same for you.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141413077.668167.315380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
It looks like that a lot of people have this problem, i.e., no
exception is thrown, but messages got packed up under
Inetpub/mailroot/Queue/ and never get sent. However, there does not
seem to have a solution so far. I googled around, only see people
asking for help, no one has really offered a solution to this problem.
At the following link, Leszek did say the problem was solved. But
she/he did not go into detail about her solution. E.g., How to set up
a real sender address on the SMTP virtual server? She/He did not
explain it.
Also, it looks like that she/he was using smarthost, which to my
understanding, is sending mail through a remote SMTP server provided by
some ISP. That would be a different story from what I am trying to
solve.
Here is that post:
http://groups.google.com/group/microsoft.public.inetserver.iis/browse_thread/thread/555467a64e9cf69a/9675868e46c5729c?q=Wei-Dong+Xu+SMTP+server+configuration+&rnum=1#9675868e46c5729c
From: Leszek - view profile
Date: Tues, Sep 9 2003 7:39 am
Email: "Leszek" <tarat...@xxxxxxxxxxxxxxx>
Groups: microsoft.public.inetserver.iis
Thank you very much.
There were several problems with my IIS configuration (smart host, smtp
server name etc). Moreover it turned out that I needed to set up a real
sender address (From: field) to enforce the IIS to send emails. Strange
but now it works perfectly.
Juan T. Llibre wrote:
re:
I am using .Net Framework 1.1
Youi'll find sample code for changing the port number under system.web.amil here :
http://systemwebmail.com/faq/2.9.aspx
Essentially :
MailMessage mail = new MailMessage();
mail.To = "me@xxxxxxxxxxxxx";
mail.From = "you@xxxxxxxxxxxxxxx";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "your port
number");
SmtpMail.SmtpServer = "YourSmtpServer";
SmtpMail.Send(mail);
There's VB.NET sample code in the same page.
Keep that systemwebmail link handy.
All the info you need to solve web mail problems under .Net 1.1 is there.
There's specific answers for both the "Could not access 'CDO.Message' object"
and "The transport failed to connect to the server" exceptions which you reported.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141403139.000632.184690@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Juan,
Thanks a lot. Unfortunately, it looks like that the SmtpClient is only
available with .Net framework 2.0
I am using .Net Framework 1.1
I know nothing about 2.0 at this point of time. Is there any way to go
around this?
Juan T. Llibre wrote:
re:
Too bad that the .Net SmtpMail class does not let us set the port number.
But it does allow you to do that :
static void ChangePort()
{
//create the mail message
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress("me@xxxxxxxxxxxxx");
mail.To.Add("you@xxxxxxxxxxxxxxx");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
//to change the port (default is 25), we set the port property
smtp.Port = 587;
smtp.Send(mail);
}
Of course, for that to work you must set IIS's SMTP server
to the same port you set in your code. You can use any TCP port.
To do that, view the Properties of the Default SMTP Server;
click the "Delivery" tab; click the "Outbound Connections" button;
and set the port number you want in the "Tcp port" box.
That will get around your ISP's blockage of port 25.
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<antonyliu2002@xxxxxxxxx> wrote in message
news:1141364101.185493.190200@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Juan,
Now I am having the typical "Could not access 'CDO.Message' object" and
"The transport failed to connect to the server" exceptions.
------=_NextPart_000_0047_01C63EC2.E70415E0
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Google-AttachSize: 6344
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.3790.2577" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>re:<BR>>I am using .Net Framework
1.1<BR><BR>Youi'll find sample code for changing the port number under
system.web.amil here :<BR><BR></FONT><A
href="http://systemwebmail.com/faq/2.9.aspx"><FONT face=Arial
size=2>http://systemwebmail.com/faq/2.9.aspx</FONT></A><BR><BR><FONT face=Arial
size=2>Essentially :<BR><BR></FONT><PRE class=csharp onmouseover="this.style.cursor='hand';"
title="Click to copy to clipboard" style="CURSOR: hand" onclick=copyToClipboard(this);><FONT
face=Arial size=2>MailMessage mail = new MailMessage();
mail.To = "me@xxxxxxxxxxxxx";
mail.From = "you@xxxxxxxxxxxxxxx";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "your port
number");
SmtpMail.SmtpServer = "YourSmtpServer";
SmtpMail.Send(mail);
</FONT></PRE><BR><FONT face=Arial size=2>There's VB.NET sample code in the same
page.<BR><BR>Keep that systemwebmail link handy.<BR>All the info you need to
solve web mail problems under .Net 1.1 is there.<BR><BR>There's specific
answers for both the "Could not access 'CDO.Message' object"
<BR>and "The transport failed to connect to the server" exceptions which
you reported.<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><BR><FONT face=Arial size=2> <BR>Juan T. Llibre, asp.net
MVP<BR>aspnetfaq.com : </FONT><A href="http://www.aspnetfaq.com/"><FONT
face=Arial size=2>http://www.aspnetfaq.com/</FONT></A><FONT face=Arial size=2>
<BR>asp.net faq : </FONT><A href="http://asp.net.do/faq/"><FONT face=Arial
size=2>http://asp.net.do/faq/</FONT></A><BR><FONT face=Arial size=2>foros de
asp.net, en español : </FONT><A href="http://asp.net.do/foros/"><FONT face=Arial
size=2>http://asp.net.do/foros/</FONT></A><FONT face=Arial size=2>
<BR>===================================</FONT></DIV>
<DIV><FONT face=Arial size=2><</FONT><A
href="mailto:antonyliu2002@xxxxxxxxx"><FONT face=Arial
size=2>antonyliu2002@xxxxxxxxx</FONT></A><FONT face=Arial size=2>> wrote in
message </FONT><A
href="news:1141403139.000632.184690@xxxxxxxxxxxxxxxxxxxxxxxxxxxx"><FONT
face=Arial
size=2>news:1141403139.000632.184690@xxxxxxxxxxxxxxxxxxxxxxxxxxxx</FONT></A><FONT
face=Arial size=2>...</FONT></DIV><FONT face=Arial size=2>Hi,
Juan,<BR><BR>Thanks a lot. Unfortunately, it looks like that the
SmtpClient is only<BR>available with .Net framework 2.0<BR></FONT><FONT
face=Arial size=2><BR>I am using .Net Framework 1.1<BR><BR>I know nothing about
2.0 at this point of time. Is there any way to go<BR>around
this?<BR><BR>Juan T. Llibre wrote:<BR>> re:<BR>> >Too bad that the .Net
SmtpMail class does not let us set the port number.<BR>><BR>> But it does
allow you to do that :<BR>><BR>> static void ChangePort()<BR>>
{<BR>> //create the mail message<BR>> MailMessage mail = new
MailMessage();<BR>><BR>> //set the addresses<BR>> mail.From = new
MailAddress("</FONT><A href="mailto:me@xxxxxxxxxxxxx"><FONT face=Arial
size=2>me@xxxxxxxxxxxxx</FONT></A><FONT face=Arial size=2>");<BR>>
mail.To.Add("</FONT><A href="mailto:you@xxxxxxxxxxxxxxx"><FONT face=Arial
size=2>you@xxxxxxxxxxxxxxx</FONT></A><FONT face=Arial size=2>");<BR>><BR>>
//set the content<BR>> mail.Subject = "This is an email";<BR>> mail.Body =
"this is the body content of the email.";<BR>><BR>> //send the
message<BR>> SmtpClient smtp = new SmtpClient("127.0.0.1");<BR>><BR>>
//to change the port (default is 25), we set the port property<BR>> smtp.Port
= 587;<BR>> smtp.Send(mail);<BR>> }<BR>><BR>> Of course, for that to
work you must set IIS's SMTP server<BR>> to the same port you set in your
code. You can use any TCP port.<BR>><BR>> To do that, view the Properties
of the Default SMTP Server;<BR>> click the "Delivery" tab; click the
"Outbound Connections" button;<BR>> and set the port number you want in the
"Tcp port" box.<BR>><BR>> That will get around your ISP's blockage of port
25.<BR>><BR>><BR>><BR>> Juan T. Llibre, asp.net MVP<BR>>
aspnetfaq.com : </FONT><A href="http://www.aspnetfaq.com/"><FONT face=Arial
size=2>http://www.aspnetfaq.com/</FONT></A><BR><FONT face=Arial size=2>>
asp.net faq : </FONT><A href="http://asp.net.do/faq/"><FONT face=Arial
size=2>http://asp.net.do/faq/</FONT></A><BR><FONT face=Arial size=2>> foros
de asp.net, en español : </FONT><A href="http://asp.net.do/foros/"><FONT
face=Arial size=2>http://asp.net.do/foros/</FONT></A><BR><FONT face=Arial
size=2>> ===================================<BR>> <</FONT><A
href="mailto:antonyliu2002@xxxxxxxxx"><FONT face=Arial
size=2>antonyliu2002@xxxxxxxxx</FONT></A><FONT face=Arial size=2>> wrote in
message<BR>> </FONT><A
href="news:1141364101.185493.190200@xxxxxxxxxxxxxxxxxxxxxxxxxxxx"><FONT
face=Arial
size=2>news:1141364101.185493.190200@xxxxxxxxxxxxxxxxxxxxxxxxxxxx</FONT></A><FONT
face=Arial size=2>...<BR>> Hi, Juan,<BR>><BR>> Now I am having the
typical "Could not access 'CDO.Message' object" and<BR>> "The transport
failed to connect to the server" exceptions.<BR></FONT></BODY></HTML>
------=_NextPart_000_0047_01C63EC2.E70415E0--
.
- Follow-Ups:
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- References:
- Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Bruce Barker
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: antonyliu2002@xxxxxxxxx
- Re: Mail sent through IIS virtual SMTP server not arriving
- From: Juan T. Llibre
- Mail sent through IIS virtual SMTP server not arriving
- Prev by Date: Session state timing out in 20 min. regardless of web.config
- Next by Date: How to fire validation in CreateUserWizard next button?
- Previous by thread: Re: Mail sent through IIS virtual SMTP server not arriving
- Next by thread: Re: Mail sent through IIS virtual SMTP server not arriving
- Index(es):
Loading