Setting up intranet web server to send e-mails - iis

All I want to do is have an ability for my intranet web server to send e-mails.
I'm trying to set up the SMTP to listen on port 25 while the websites are on port 80.
I think I might have something that could work (after following a tutorial) but I'm missing a key piece of information. Each site describing how to set up an SMTP server falls short of telling me where I need to go to set up a new e-mail account for this SMTP.
Without it I can't use the powershell lines of code to see if I've set it up correctly (I don't have a "from" to use).
Send-MailMessage
–From ???#[Servers Intranet IP]:25
–To recipient#recipientdomain.com
–Subject “Test Email”
–Body “Test E-mail (body)”
-SmtpServer [Servers Intranet IP]:25
Note I don't know if [Servers Intranet IP]:25 is correct or not but I get a feeling if I can answer how to create the "From" then that piece of information will fall into place. The sites can be accessed internally using [someText].[otherText].net:80 and [Servers Intranet IP]:80
Note: I manage my website using IIS Manager (Version 10.0.14393.0) but the tutorial I followed for creating my SMTP forced me to go use IIS 6.0 Manager. The SMTP virtual server wasn't showing up in IIS Manager (V 10).
Note: In IIS 6.0 Manager, [SMTP Virtual Server #1] has a Domain Name [someText].[otherText].net and Type Local (Default) and it is running.
If this is too obvious, dumb, or makes 0 sense so much so that I deserve a -1 please tell me why and then give me a -1.
More info.
PS C:\Users\[UserName]> Get-Process -Id (Get-NetTCPConnection -LocalPort 25).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
545 49 16112 27040 0.73 6340 0 inetinfo

Related

Need help creating captive portal on Windows 10 hotspot

I have been trying to implement a sort of captive portal for users connected to my windows 10 hotspot, I am just trying to make it so when users connect to the hotspot they either get a pop up of the site I'm hosting locally or when they go to any domain in their browser it redirects them to the local site.
I have been trying to follow an already existing post on windows hot spot captive portals but I cannot get it working because I just don't know enough about how it works.
1. Start windows mobile hotspot.
2. Go to Network adapters => Select hotspot adapter => Change IPv4 settings => set 127.0.0.1 as DNS server.
3. Start dnschef with --fakeip = 192.168.137.1
4. Start an http server on 192.168.137.1 and give 302 redirect response to all requests.
I was following these instructions and I was able to get to step 3. At step 3 when the device tries to connect to a domain it has never connected to before it is properly redirected to my site but when I connect to a site like google.com it just doesn't load and wont redirect. It also wont give a captive portal popup when you first connect to the network.
I cannot get past step 3 because I do not understand how to Start an http server on 192.168.137.1 and give 302 redirect response to all requests. Some help on how I would be able to do this would be greatly appreciated, thank you.

New IIS 10 site on different port can only be accessible on VM directly via http://localhost:portnumber

I am managing a Windows Server 2016 Azure VM in the cloud that has IIS version 10 installed.
It currently has 2 sites that is live
Namely
http://www.clientdomain.com
http://portal.clientdomain.com
Both these sites work.
I need to setup a test site just for testing purposes.
I create 2 test sites in IIS and setup the bindings with hostname portal.clientdomain.com on port 88 and port 89 respectively in the IIS bindings.
I use a different port than 80,443 so it doesn't interfere with the live site
This works if I type in my browser
http://localhost:88 or https://localhost:89 on the VM directly
However, it needs to be accessible outside the VM on the internet.
For one or other reason I can't get the site url to open up in the browser.
Some of the URLs I have tried:
http://portal.clientdomain.com
http://sitename.westus.cloudapp.azure.com:88
http://TheIPAdress:88
http://clientdomain.com:88
which all the following cause the browser to gives the error This site cannot be reached with details The server took too long to respond
I tried various bindings too but nothing works.
My question:
Why does http://localhost:88,https://localhost:89,http://portal.clientdomain.com work directly on the server, however http://portal.clientdomain.com:88 or http://portal.clientdomain.com:89 do not if I made the bindings match. I also tried it with no bindings. Nothing works.
I have tried adding the ports to the Firewall as Inbound TCP rules but result is the same.

How do I set up a subdomain on my locally hosted IIS server?

I have IIS (8.5) running on a local Windows Server 2012 computer named (for the purposes of this question) SERVER_1. This server has CGI/FastCGI running and working on it. I use this server for various things, but one of the things I use it for is for hosting an internal Wiki (MediaWiki). My design choice, not looking for online solutions.
Everything is working with my current binding that is:
Type Host Name Port IP Address Binding Information
http SERVER_1 80 *
If I go to a Windows browser from an intranet computer I can hit my Wiki page by going to http://SERVER_1 (unless it's on Mac - different issue I haven't figured out yet).
What I'm looking to do, however, is have it be accessible by going to http://wiki.SERVER_1 but no matter how I configure the bindings it doesn't seem to work. For example:
Type Host Name Port IP Address Binding Information
http wiki.SERVER_1 80 *
Can anyone shed some light on this?

Setting up SMTP under IIS 7 on Windows Server 2008

Website started life originally under IIS 6 and the site worked great there. Now after relocating to a new server running W2K8S, everything but mail delivery from the website now works great under IIS 7.
Researched briefly on the Web to see if anybody had a good resolution, but no avail... Not even a glimmer of hope on Microsoft's own support site.
Here are the steps taken so far on the new W2K8S box:
Added the feature for SMTP under the Server Manager
Enabled SMTP e-mail for the site itself in IIS 7 Manager to deliver e-mail to SMTP server local host, unsuccessful
Enabled SMTP e-mail for the root site in IIS 7 Manager (not sure if that needs to be on to enable sites) to deliver e-mail to SMTP server local host, unsuccessful
After failing those basic setups, I wanted to be sure I can actually talk from/to the serveron port 25. And I can successfully telnet from/to the server in question to a test e-mail on port 25 get a HELO, etc. So I do not believe it is a firewall config issue.
The IIS 7 setup test was performed with both anonymous and Windows authentication - no luck either way.
Manually checked Web Config file and it reflects correct entry for the server to use the localhost.
Read the manual and no luck there either... :-/
I faced the same problem.
I came across this link http://www.frontpagewebmaster.com/m-215289/tm.htm
and I was able to solve the issue. Go to the last post of this link.
In my case I solve problem by giving rights to "NETWORK SERVICE" user to the "Pickup" folder.
Hope this might help....
OK, to the post that said "give NETWORK USER the write rights to the pickup folder" it finally works. What I did was:
You need to use a "smart host" unless you are running exchange server. I am using a Gmail account, Gmail allows SMTP forwarding.
You can use Windows authentication for security on the SMTP server and the IIS7 config setting.
First step, set the delivery method = "network" in your web page, and get your smart host configured independently of the SMTP server.
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false; // use your smart host login client.Credentials = new NetworkCredential("xxxxx#gmail.com", "password");
client.EnableSsl = true;
This will send the email directly and bypass your SMTP server.
Second step, once you have that working, write a sample windows app to use your SMTP server independent of your web page, and get that working.
SmtpClient client = new SmtpClient("your server ip", 25);
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.EnableSsl = false; // you can't use ssl with a pickup folder
client.UseDefaultCredentials = true; // use windows credentials
This will bypass your web page and make sure you have your SMTP server configured properly.
Finally, get your web page working, by setting the sharing on your pickup folder to allow write access to NETWORK_SERVICE. Transfer the login info from step 3, into your SMTP settings, set authentication to integrated security, and use the code in step 4 for your web page.
I had exactly the same problem as described in this old question. Finally I found a solution to it. In my case the operation system is W2008 R2 with IIS 7.5, but I think this doesn’t matter.
The underlying problem is that the SMTP Service in W2008 R2 seems to be a legacy part of the IIS. It is installed with the IIS 6.0 administration tools, side by side to the IIS 7.X Server. This causes two derived problems:
IIS 7.X knows nothing about the SMTP service. If you configure SMTP in ASP.NET to use the PickupDirectoryFromIis this results in an exception. Therefore you can’t use this SMTP configuration:
<smtp deliveryMethod="PickupDirectoryFromIis" />
But it is possible to configure SMTP with SpecifiedPickupDirectory, You can use this configuration:
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot\Pickup" />
</smtp>
If you configure the pickup directory in this way, you may run into a second kind of problem: IIS6 and IIS7.X have different security systems. IIS 7.X introduces integrated security with application pool identities. IIS 6.0 and its SMTP service don’t know about this. Therefore you have to grant write permissions for IIS_IUSRS to the pickup folder. In my configuration the pickup folder is C:\inetpub\mailroot\pickup.
I noticed that the event ID 4006 was refering to the domain controller ip instead of the mail server ip.
I used the iis 6 admin tool to configure a smarthost pointing to the mail server and voila! the issue was resolved.
I am not sure if this diagnostic tool can provide more insights,
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1308
This tool is for x86.
Have you checked to see if the SMTP service is accepting mail for relay from localhost? To do this, telnet from the machine in question to the local SMTP server and use SMTP commands to send a test message. The SMTP service is very picky about command formatting so you'll have to be careful when entering commands (i.e. don't use backspace to correct typographical errors).
Is this, by chance, an old "classic" ASP app relying on CDONTS to send mail?
If so, perhaps one of these links would be helpful?
Edited: I had replied before noticing the note on the original post. Disregard...
I came across this post when researching getting SMTP running on my ASP.Net app we're migrating from IIS6 to IIS7. What I found was we didn't have to set up the SMTP SERVER at all - simply setting up SMTP Email was enough - with the additional benefit of NOT having the security concerns of SMTP relaying thru the web server!
so if you don't need your web server to actually do the SMTP routing, you don't have to set up the server at all in IIS7.

Limit dev environment to e-mail only certain domains for testing (XP smtp IIS)

I'm developing a website on an XP virtual machine and have an SMTP virtual server set up in IIS -- it delivers mail just fine. What I would like is to confirm that any emails the site sends are only going to a specific domain.
The XP firewall seems to only involve incoming connections, I can't block outgoing TCP on port 25. And I haven't been able to configure the SMTP server to filter by delivery address.
With this setup, is there any easy way to filter outgoing email by destination address?
Here's one idea:
Under Advanced Delivery options (SMTP Virtual Server Properties > Delivery tab > Advanced). There you can set a "Smart Host" which is the SMTP server that will be used to actually send the mail, so you could possibly have it deliver directly to the specific domain's incoming SMTP server.
I think the easiest way would be to add a check to your mail sending code on the website (there's got to be some class which is in charge of sending the mails out).
You could include a check which is only active when the code is compiled in debug mode (using compiler directives). Thus, when you are developing and building the site in debug mode, this code checks if the outgoing messages are valid (specific domain) or not. If they are it lets them go, else it doesn't send the mail.

Resources