ASPX templates
Version 5.x > ASPX templates > SMTP Settings in Web.Config View modes: 
User avatar
Member
Member
eric.rovtar-hudsonchapel - 7/30/2010 8:37:15 AM
   
SMTP Settings in Web.Config
Hi!

I'm trying to write a function that will send an e-mail message. I've done this many times in ASP, so I copied the SMTP information that I would usually use to the web.config file:

<system.net>
<mailSettings>
<smtp>
<network userName="webmaster@visitmychurch.tv" password="******"/>
</smtp>
</mailSettings>
</system.net>


Whenever I try to send a message, this is the error response:


Error: System.InvalidOperationException: The SMTP host was not specified.
at System.Net.Mail.SmtpClient.CheckHostAndPort()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at CMSTemplates_AuroraChapel_AJAX.GetDate()


Any ideas? Idk how else to setup the credentials for SMTP.

Thanks!

-Eric

User avatar
Member
Member
info-angrybullmedia - 7/30/2010 8:51:03 PM
   
RE:SMTP Settings in Web.Config
Hi Eric,

You'll need to set up an SMTP host in your web.config file - try the following (this is assuming that your smtp host is "smtp.visitmchurch.tv" and its smtp port is 25):

<system.net>
<mailSettings>
<smtp from="webmaster@visitmychurch.tv">
<network host="smtp.visitmychurch.tv" port="25" userName="webmaster@visitmychurch.tv" password="******"/ />
</smtp>
</mailSettings>
</system.net>


HTH - Dries Janssens

User avatar
Member
Member
jgriffith-nfusion - 2/13/2012 3:08:21 PM
   
RE:SMTP Settings in Web.Config
Which web.config file does this go in? I see several littered throughout the codebase. I am also using ASPX templates if that makes a difference.