Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,
I have planed on creating a website with mail functionality. I should have the mail Settings like host, port, user Name, password... Where can I get those things. Please advice me...
Thank You....
Posted

From the web.config? Like this

On your web.config:
XML
<appsettings>
     <add key="smtpServer" value="mail.domain.net" />
     <add key="smtpPort" value="25" />
     <add key="from" value="noreply@domain.net" />
     <add key="mailUser" value="user@domain.net" />
     <add key="mailPassword" value="password" />
</appsettings>


On your code C#
C#
var mailUser = ConfigurationManager.AppSettings["mailUser"].ToString();
var mailPassword = ConfigurationManager.AppSettings["mailPassword"].ToString();
var from = ConfigurationManager.AppSettings["from"].ToString();
var smtpServer = ConfigurationManager.AppSettings["smtpServer"].ToString();
var smtpPort = ConfigurationManager.AppSettings["smtpPort"].ToString();
 
Share this answer
 
The administrator of the Server where you are going to host should provide you those settings.
Contact their support team.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900