Hi all,
Not sure if this is the correct forum to post this, but this is the closest I could find.
We've had a Windows 2003 server with .Net Framework 2 and two sites running on it. Both used to send mails and worked fine.
Then due to some reason had to shift to a Windows Server 2008 R2 with IIS 7. The sites are up and running again. But the mails are not being sent. I hosted a test page in the site (with the same code in the actual page that fires the mail) which sends mail
and it too works fine most of the time.
Dim Mail As New MailMessage("FromEmail", "ToEmail", "Subject", "Message")
Mail.IsBodyHtml = True
Mail.Priority = MailPriority.Normal
Dim smtpclint As New SmtpClient("mail server IP")
smtpclint.UseDefaultCredentials = True
smtpclint.Port = 25
smtpclint.Send(Mail)
Mail.Dispose()
I log the error that comes and it says "Mailbox unavailable. The server response was: must check for new mail first "
Where I'm lost is why it successfully send the mail at one time and fails the other? Any clues as to what I've done wrong is greatly appreciated.
Well, it is stated in the product document during the release, since IIS 7 debut few years ago.
And it doesn't belongs to IIS team but the exchange team.
No doubt it suck when it came to this part, I too was expecting a better smtp client, but it looks like this is not what IIS team is focusing on.
prasaw77
2 Posts
Re: Setting up SMTP on IIS 7
Dec 06, 2011 05:51 AM|LINK
Not sure if this is the correct forum to post this, but this is the closest I could find.
We've had a Windows 2003 server with .Net Framework 2 and two sites running on it. Both used to send mails and worked fine.
Then due to some reason had to shift to a Windows Server 2008 R2 with IIS 7. The sites are up and running again. But the mails are not being sent. I hosted a test page in the site (with the same code in the actual page that fires the mail) which sends mail and it too works fine most of the time.
Dim Mail As New MailMessage("FromEmail", "ToEmail", "Subject", "Message")
Mail.IsBodyHtml = True
Mail.Priority = MailPriority.Normal
Dim smtpclint As New SmtpClient("mail server IP")
smtpclint.UseDefaultCredentials = True
smtpclint.Port = 25
smtpclint.Send(Mail)
Mail.Dispose()
I log the error that comes and it says "Mailbox unavailable. The server response was: must check for new mail first "
Where I'm lost is why it successfully send the mail at one time and fails the other? Any clues as to what I've done wrong is greatly appreciated.
qbernard
5011 Posts
MVP
Moderator
Re: Setting up SMTP on IIS 7
Dec 06, 2011 10:18 AM|LINK
That's weird to me as well.
Anyway is this 'mail server ip' belong to you or ?
Can check the mail server smtp log?
What's the status code on the local smtp log ?
Bernard Cheah
prasaw77
2 Posts
Re: Setting up SMTP on IIS 7
Dec 07, 2011 06:44 AM|LINK
Thanks for the reply.
Not sure what exactly triggerd it, but sorted it out after doing the following.
1. In the SMTP Vertual Server (In IIS 6 Console), added the Local server IP (In my case the local network IP) to allow list
2. Change the code
From : Dim smtpclint As New SmtpClient("mali server IP")
To : Dim smtpclint As New SmtpClient("IIS Server Local Network IP")
3. Restarted IIS 7
This sorted it out it seems.
qbernard
5011 Posts
MVP
Moderator
Re: Setting up SMTP on IIS 7
Dec 13, 2011 02:06 AM|LINK
So previously the mail server IP is another server or public ip of this IIS SMTP server?
It just weird that it works from time to time :)
Anyway, glad your sorted it out.
Bernard Cheah
prjeyanth
1 Post
Re: Setting up SMTP on IIS 7
Feb 10, 2012 06:22 AM|LINK
Hello Sir Plz Figure out how to setup SMTP Server in Web Administrator Tool in Visual Studio 2010...qbernard
5011 Posts
MVP
Moderator
Re: Setting up SMTP on IIS 7
Feb 12, 2012 03:31 AM|LINK
I don't know VS, but you can try - http://msdn.microsoft.com/en-us/library/ms400808(v=vs.80).aspx
or google for more clues.
Bernard Cheah
David V
1 Post
Re: Setting up SMTP on IIS 7
Apr 10, 2012 11:44 AM|LINK
I just spent 30 minutes looking for these settings in IIS 7 (found in IIS 6 after reading poster above), why is this half baked MSFT?
qbernard
5011 Posts
MVP
Moderator
Re: Setting up SMTP on IIS 7
Apr 12, 2012 05:46 AM|LINK
Well, it is stated in the product document during the release, since IIS 7 debut few years ago.
And it doesn't belongs to IIS team but the exchange team.
No doubt it suck when it came to this part, I too was expecting a better smtp client, but it looks like this is not what IIS team is focusing on.
Bernard Cheah