Free Support Forum -

Utilizing mailSettings config section?

I have an 2.0 app which uses membership and already has the smtp mailSettings section in the web.config file. I’d like to be able to use this to get the host info for creating the Aspose SmtpClient object. Has anyone done this? Is there an easy way to read the host info out of that config section and pass it to the Smtp object?

Hi, thanks for considering Aspose.Network.

Our development team is working on this issue. We will provide some solutions ASAP.

Thanks for your patience.

Hi, digitalman,

Thanks for your considering

The issue about using the mailsetting section in the web.config file is
studied carefully by our developers. Because of the feature is
supported only in .net 2.0 and the is still based on
.net 1.1, it is a little bit difficult to support that features at

However, we will have some plans to port the to pure .net 2.0 and integrate with more features of .net 2.0.

We have created some samples code for you, and feel free to use it
according to your needs. If you have any problems, we are more than
glad to provide any helps or sample codes.

public partial class _Default : System.Web.UI.Page


protected void Page_Load(object sender, EventArgs e)


SmtpSection smtpSec =

Response.Write(smtpSec.Network.Host + “\r\n”);

Response.Write(smtpSec.Network.UserName + “\r\n”);

Response.Write(smtpSec.Network.Password + “\r\n”);

Response.Write(smtpSec.Network.Port + “\r\n”);

//initialize the mailmessage class

SmtpConnection conn = new
SmtpConnection(smtpSec.Network.Host, smtpSec.Network.Port,
smtpSec.Password, smtpSec.Password);

//create MailMessages

MailMessage msg = new
MailMessage(smtpSec.From, "", “hello”, “hello




Web.Config file as following

<?xml version="1.0"?>


<network host="localhost" port="25"

userName=“youraccount” password=“yourpassword”/>


That’s perfect! Exactly what I was looking for. Thanks.