Link to home
Start Free TrialLog in
Avatar of CPKGDevTeam
CPKGDevTeamFlag for United States of America

asked on

C# Programming and IIS security

Hello All:

Our company is currently working on a website upgrade from the C# programmer who originally wrote the code.  In his 2nd version of the application; he has changed the authentication type (using Windows auth and tables with authentication data).  This application sends email to users in the organization and outside the organization.

Our IT consultant does not want us to use IIS on the in-house web server to pass email, as this could leave us vulnerable to spamming and eventually blacklisting.

Our C# programmer does not have the understanding of how to send the email outside of IIS.

Our hosted email company does support ASP mail with code so that we can use their servers to send email.  Our programmer does not know how to apply the code in order to avoid the IIS server sending the email.

Apologies if this is a vague question, but what we really need to assess is what road should we be heading down?

1. Should we be looking into keeping the emails passing through IIS and look into ways to secure the server from outside spamming?  Upside/downside of keeping email passing through IIS?

2. Should we be looking into finding another C# programmer who would need to learn this current application and then how to apply the ASP mail settings from our hosted email company? Should this be a specific skill set of a C# programmer, or should we be looking for other areas of expertise?

3. I should state that our email provider does not allow email with authentication.  We would really like to use them as we could more easily do message tracking through them should we have the need to troubleshoot mail issues in the future.  Is this relevant in our decision? Any drawbacks to using ASP mail in our application?

4. Is there a 3rd party application that we should be investigating?  Are there drawbacks?  Anyone have any recommendations/success stories?

Please let me know if there is more information needed.  I was sparing on specifics; as I think this is more a question of general best practices versus specific code.  But I can give details where needed.

Thank you in advance and while I don't expect the experts to train me; points will be awarded for those who can make important distinctions that are not within my skill set so we can move forward.

(75 points per question asked above)

Sincerely,
KLB
ASKER CERTIFIED SOLUTION
Avatar of Todd Gerbert
Todd Gerbert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CPKGDevTeam

ASKER

tgerbert:

Thank you for your answers. To clarify point #3; our hosted email provider (Intermedia) has given us code to use to send email using System.Web.Mail namespace.  We host our own website.

Below is Intermedia's C# example of System.Web.Mail.  Unfortunately, I do not know how this could be applied to our current C# application.  And it seems that neither does our C# programmer.

We use Intermedia for hosted email AND we have our DNS there as well (should that be a consideration).  And we cannot send email without authentication (when using pop); but the ASP mail was supposed to be a work around.  Am I misunderstanding the information I was given by Intermedia?

Thanks again,
KLB

The .NET framework allows us to send emails of both text and HTML formats using classes of the following namespaces:

System.Web.Mail (for ASP.NET 1.1)

To send mail using System.Web.Mail namespace you must use scriptmail.intermedia.net SMTP server. The below examples are written in C# and VBScript, they they will work on all our Windows 2000 and Windows 2003 servers.

C#

<%@ Import Namespace="System.Web.Mail"%> 
<script language="C#" Debug="true" runat="server"> 
    void Page_Load()
    {
            try 
            {
            MailMessage oMsg = new MailMessage();
            oMsg.From = "mailbox@yourdomain.com";
            oMsg.To = "recipient@theirdomain.com";
            oMsg.Subject = "Send Using Web Mail";
            oMsg.BodyFormat = MailFormat.Html;
            oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
            SmtpMail.SmtpServer = "scriptmail.intermedia.net";
            SmtpMail.Send(oMsg);
            oMsg = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
        }
</script>

Open in new window

POP is for retrieving mail, SMTP is for sending. They're saying you can send mail using their SMTP server, which is scriptmail.internedia.net, and they have provided you with a very simple, very generic, example for illustrative purposes - you don't have to use their code (it's just a sample).  I would guess, however, that the SMTP server they've given you will only accept mail from their own web servers - which means such code would only work correctly if the website were hosted on one of Intermedia's servers, and not on your server.  Also possible, but less likely, is that the SMTP server requires a username & password, that Intermedia has provided to you, and will work with code running on any web server.
Don't you have POP and SMTP server addresses for your e-mail system?  You should be able to setup a username and password on your hosted e-mail system, and use those credentials for sending mail from your web application.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks again to the community.

I am much closer now to getting all parties working together in order to go live.

Much appreciation.

KLB