Several features of mojoPortal content management system send email messages, and for these features to work you must configure an SMTP server in Administration > Site Settings > Email Settings

Prior to mojoPortal 2.6, it was possible to configure email settings in the Site Setting but, by default, the settings were configured in the user.config. If you upgraded your site to mojoPortal 2.6 and want to configure your Email Settings in the Site Settings, open your user.config and add the following, then touch the web.config to restart your site. Note that once you set this to true the rest of the SMTP settings in user.config are ignored and the settings that you create in Site Settings will be used.

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

Multi-Site Installations

If you want all the sites in a multisite installation to use the same SMTP settings, you will need to add the following to your user.config and then touch the web.config to restart your site.

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

<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" />
-->

Common Examples

These examples are meant to help but we can't guarantee they are correct because email providers may change their settings over time and we may not notice the changes.

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" />

Testing

To test your email settings, go to Site Settings > Mail Settings and enter an email address in the "Email Address" input under "Test SMTP Settings", then click the "Send Test Message" button. This will test if mojoPortal is able connect to an email server using the settings you have provided. It does not test that the email is actually received.

Custom SMTP Headers

Sometimes it is necessary to set custom SMTP Headers to more easily track where a message is coming from or what the message's purpose is. Some email providers, like Postmark, use headers to route emails through particular queues.  To set custom headers on email sent from your mojoPortal site, go to Site Settings > Mail Settings and enter the headers in the "Custom SMTP Headers" input. Each header must be entered on its own line in this format: HeaderName: header value.

Bulk E-mail

mojoPortal has special features to help with sending bulk e-mail. Check out our Sending Bulk E-Mail article for more information.

Troubleshooting Tips

If you are having trouble getting email working, you should use the Contact Form to test until it works. Set up your own email address as the contact form recipient and then post messages.

Whatever email address you are using to send emails should be specified as the "Default Email From Address" in Administration Menu > Site Settings > Mail 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 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 Jul 25, 2023