Several features of mojoPortal content management system send email messages, and for these features to work you must configure an SMTP server in the Web.Config file (or ideally in user.config).

appSettings Configuration

In the appSettings section you will need to edit these settings:

<add key="SMTPServer" value="localhost" />
<add key="SMTPRequiresAuthentication" value="false" />
<add key="SMTPPort" value="25" />
<add key="SMTPUser" value="UserName" />
<add key="SMTPPassword" value="UPassword" />
<!-- leave this blank for ascii encoding -->
<add key="SmtpPreferredEncoding" value="" />
<!-- example for Russian encoding
<add key="SmtpPreferredEncoding" value="koi8-r" />
-->

In many cases, these default settings might work if you have an SMTP server running locally on the web server but in other cases, your environment will differ and you will need to change these. You can also specify these or any other appSettings in user.config. This can save you from having to re-edit them when upgrading because user.config won't be overwritten during upgrades like other files.

Office365 Example

If you're using an Office365 email account, these settings should work for you. The server information shown here was taken from this Microsoft Documentation.

<add key="SMTPServer" value="smtp.office365.com" />
<add key="SMTPRequiresAuthentication" value="true" />
<add key="SMTPPort" value="587" />
<add key="SMTPUser" value="office365emailaddress" />
<add key="SMTPPassword" value="office365password" />
<add key="SMTPUseSsl" value="true" />

Note: Office 365 requires TLS. The setting "SMTPUseSSL" uses TLS and then tries SSL if TLS fails.

Yahoo Example

If you're using a Yahoo email account, these settings should work for you, but of course, it varies with different email providers.

<add key="SMTPServer" value="smtp.bizmail.yahoo.com" />
<add key="SMTPRequiresAuthentication" value="true" />
<add key="SMTPPort" value="587" />
<add key="SMTPUser" value="youryahooemailaddress" />
<add key="SMTPPassword" value="youryahoopassword" />
<add key="SMTPUseSsl" value="false" />

Notes: smtp.bizmail.yahoo.com is the SMTP server for email addresses connected to Yahoo Domains accounts. For normal yahoo accounts, the setting is smtp.mail.yahoo.com

Also, you may not need the @yahoo.com for the username. So if your yahoo email is yourname@yahoo.com you might just put your name.

Gmail Example

<add key="SMTPServer" value="smtp.gmail.com" />
<add key="SMTPRequiresAuthentication" value="true" />
<add key="SMTPPort" value="587" />
<add key="SMTPUser" value="yourusername@gmail.com" />
<add key="SMTPPassword" value="yourgmailpassword" />
<add key="SMTPUseSsl" value="true" />

Multi-Site Installations

By default, all the sites in a multisite installation will use the SMTP settings from the appSettings section of Web.config (or user.config), but you can enable a hidden feature which will make the SMTP settings show up in the Administration Menu > Site Settings Page. In Web.config (or ideally in user.config) set this setting to true:

<add key="EnableSiteSettingsSmtpSettings" value="true" />

Then you will see a new Tab in Site Settings where you can enter the SMTP configuration. Note that once you set this to true the rest of the SMTP settings in user.config are ignored and now it will use the settings that you create in Site Settings. Each site in your multisite installation will need its own settings configured.

Troubleshooting Tips

If you are having trouble getting email working I recommend you use the Contact Form to test it until it works. Set up your own email address as the contact form recipient and then post messages. The Contact Form uses the SMTP settings from the appSettings section of Web.cofig, or from Administration Menu > Site Settings if you have enabled EnableSiteSettingsSmtpSettings in Web.config.

Whatever email address you are using to send emails should be specified as the "Default Email From Address" in Administration Menu > Site Settings.

If you don't get the message, look for errors about sending mail in the mojoPortal system log under (key icon) Administration Menu > System Log. Newest errors are at the bottom, its usually best to clear the log before you start troubleshooting the problem. The error messages will usually give you a clue about the problem. If you don't understand the error you can post it in the forums and we'll try to help.

Note: If you are trying to set this up on your development machine or any machine that is connected to the internet using a consumer ISP like Comcast or RoadRunnder (TimeWarner) cable you need to know that many of those companies block all traffic on port 25 and you can only relay on port 25 through their own SMTP servers. They do this to prevent computers on their networks that may be infected with viruses from being used to send SPAM. For example, if you have a Comcast account you can only relay outbound email on port 25 using your Comcast email account and sending through the Comcast SMTP server. That's why most free email services like Yahoo and Gmail use alternate ports for SMTP like Yahoo uses port 587 for example. You can relay outbound email on ports other than 25.

system.net Configuration (required for versions prior to 2.3.6.5)

If you are running an older version of mojoPortal CMS, you also need to specify SMTP settings at the bottom of Web.config in thesystem.net section. These settings were needed to support the use of some of the built-in ASP.NET 2.0 controls likePasswordRecovery, whereas the appSettings section has been in use in mojoPortal since before 2.0 ASP.NET came out. Note: If you are running version 2.3.6.5 or later, this entire system.net section can be removed or commented out of web.config.

<system.net>
  <mailSettings>
    <smtp from="noreply@yourdomain.com">
     <network host="localhost" port="25" password="" userName="" />
   </smtp>
 </mailSettings>
</system.net>

Unfortunately, the system.net settings can't be added to the user.config file but one could use a different config file for this information. To use a separate file, first create it with the following content (for this example, the file is named smtp.config):

<smtp from="noreply@yourdomain.com">
   <network host="localhost" port="25" password="" userName="" />
</smtp>

Next, change the web.config <smtp line as follows:

<smtp userConfig="smtp.config"></smtp>

Note that there is little benefit to using a separate file for the system.net SMTP configuration settings unless you have a lot of websites to update and you do not want to edit the web.config for each site. 

Last Modified by Joe Davis on Apr 19, 2017