Sending mail from Visual Studio 2008 web app

mpdillon
Posts: 9
Joined: Thu Jul 24, 2008 10:34 am

Sending mail from Visual Studio 2008 web app

Postby mpdillon » Mon Sep 22, 2008 2:01 pm

Is there a tutorial or a how to document describing how to send emails through MailEnable professional from a Visual Studio 2008 web application?
I looked around the web site and found MailEnable Com component. But clicking on the link takes me to the Developer and API tools page. It is not clear to me what I need to download.
I looked at Visual Com C API Example but I do not recognize the file extensions in the zip file.
Can anyone offer advice on how to get started?
If a how to does not exist, let's use this thread to create one.
thanks,
pat

JohnC
Posts: 67
Joined: Fri Dec 17, 2004 10:57 am
Location: Edinburgh, Scotland

Postby JohnC » Mon Sep 22, 2008 3:27 pm

In VS2005 I just add the mail server to the App Settings in Web Config - nothing complicated.
jc

mpdillon
Posts: 9
Joined: Thu Jul 24, 2008 10:34 am

Postby mpdillon » Mon Sep 22, 2008 4:05 pm

John,
This is my first web application. Do I need to place any files in the bin directory? Would you share the web.config lines of code that you added?
Lastly, my development machine is not my production machine. MailEnable is on the production server while the development machine is on the a different XP box.
thanks,
pat

JohnC
Posts: 67
Joined: Fri Dec 17, 2004 10:57 am
Location: Edinburgh, Scotland

Postby JohnC » Tue Sep 23, 2008 2:34 pm

Pat
This is a hard question to answer in detail as there are many ways to skin the cat. Also I have no knowledge of VS2008 which may be (is) somewhat different. Using VS2005 and .NET 2.0 all you need to use is what is given by System.Net.Mail - you can set your server in code or in the App Settings either by editing the web.config directly or by using the Config tool.
Note this is a pure .NET question - all that MailEnable does is relay the mail.
In my setup we have a dedicated ME mail server on the same subnet as our web servers. ME is set to relay for all local machines (on same subnet). Like yourself I work on an XP machine on a different network to our production stuff so I can't test email until I move the app to our staging server.
So nothing in teh bin directory - use System.Net.Mail - full details here
http://www.systemnetmail.com/

j

mpdillon
Posts: 9
Joined: Thu Jul 24, 2008 10:34 am

Postby mpdillon » Fri Sep 26, 2008 1:46 pm

John,
I am up and running thanks to your response. Great web site.

On the MailEnable server I am using Maienable/Integrated Authentication. See Server>LocalHost>Connectors>SMPT>Properties>Relay tab and the Authentication Method button.
Determine a username and password to use for the outgoing mail.

To the Web.config file add(per 4Guys from Rolla)
<configuration>
<!-- Add the email settings to the <system.net> element -->
<system.net>
<mailSettings>
<smtp>
<network
host="mail.myservname.biz" get from MailEnable
port="25" in my case
userName="EmailAddress@yourcompany.biz"
password="TheActualPassword" /> From MailEnable
</smtp>
</mailSettings>
</system.net>

<system.web>
...
</system.web>
</configuration>


I Created a test page.
Add
Imports System.Net.Mail

Here is the whole send button routine.

Dim mail As New MailMessage

mail.From = New MailAddress("EmailAddress@yourcompany.biz")
mail.To.Add("YourFriend@AnotherEmailAddress.com")
mail.Subject = "Test from VB.net"
mail.Body = "Testing the VB component. Man is this easy! "

Dim smtp As New SmtpClient("mail.myservname.biz")
>> The mail.myservname.biz part is probably redundant since it was specified in the web config. But I have not confirmed that thought.<<

smtp.Send(mail)

fairyanna
Posts: 1
Joined: Fri Dec 19, 2014 9:48 am

Re: Sending mail from Visual Studio 2008 web app

Postby fairyanna » Fri Dec 19, 2014 9:51 am

Solved. I'm developing an asp.net application, so I use the two dlls recommended for it (mailenable.administration and mailenable.store). The permissions for accessing them were ok...

but the permissions for accessing the dlls referred by them no!!! It's so easy as granting access for your iis user to the mailenable.bin(or bin64) directory.
Lily lara

Who is online

Users browsing this forum: No registered users and 5 guests