Question

in my system i should send notification mail after reviewing a list i am using DNN

there is the Code i use

private void SendEmailNotification()
    {
        DotNetNuke.Services.Mail.Mail.SendMail("mail@gmail.com", "mail@ymail.com", String.Empty, "URL Test", "this is a test of dnnmail: <a href='http://www.dotnetnuke.com'>DotNetNuke</a>", String.Empty, "html", String.Empty, String.Empty, String.Empty, String.Empty);
    }

and the function calling is

SendEmailNotification();

but i dont get any mails ,,, what am i doing wrong

Était-ce utile?

La solution

When calling SendMail you are using the settings from the Host Settings section of the site. If the information is incorrect, you should get an exception out of this call.

Therefore, you might want to check to see if there is anything in Event Viewer indicating an error.

Additionally, depending on the from/to addresses that you are using, be sure to check the spam folder.

Autres conseils

SendMail should return a string, which gives an error message if there's an error. You may also check the Event Viewer to see if anything was logged there. Can you send the test email from the SMTP section of the Host Settings page? Is your SMTP server setup to allow sending as gmail.com (or whatever domain you're actually sending as)?

To add to the previous answers...

DNN will respect settings in the web.config file so even if the SMTP settings are configured in the CMS, they may be ignored depending on what is in the web.config. Specifically, if a pickup directory is specified in the web.config as is shown in the following snippet, it will override the settings in the CMS.

<system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\SMTPPickup" />
      </smtp>
    </mailSettings>
  </system.net>

If you are seeing a success returned from the send function, but are not seeing it in your inbox, the message could be in a pickup directory, double check the web.config to make sure there aren't settings overriding those in the CMS.

A little update to bdukes answer, the SMTP settings and the function to test the email in DNN 7+ are now found in the Admin->Advanced Configuration Settings area.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top