Hi,
digitalman,
Thanks for your considering aspose.network.
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 aspose.network is still based on
.net 1.1, it is a little bit difficult to support that features at
present.
However, we will have some plans to port the aspose.network 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 =
(SmtpSection)ConfigurationManager.GetSection("system.net/mailSettings/smtp");
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, "yourname@aspose.com", "hello", "hello
mailSettings");
msg.SendAsync(conn);
}
}
Web.Config file as following
<?xml version="1.0"?>
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="network@aspose.com">
<network host="localhost" port="25"
userName="youraccount" password="yourpassword"/>
</smtp>
</mailSettings>
</system.net>
...
Team Lead
Aspose Guangzhou Team
About UsContact Us