Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dan 54 posts 133 karma points
    Nov 07, 2014 @ 05:44
    dan
    0

    Sending email using default web.config settings

    I have a form I've used on other .net sites that works but in umbraco I can't use the default web.config settings. I feel there is something missing here.

    The web.config settings looks like this.

      <system.net>
        <mailSettings>
          <smtp from="[email protected]">
            <network host="smtp.ilikebigwebsites.com" userName="[email protected]" password="xxxxxxx" />
          </smtp>
        </mailSettings>
      </system.net>

     

    The form works like this:

      msg = new MailMessage(fromEmail, "donotreply@ilikebigwebsites", txtSubject, sb.ToString());

            msg.Priority = MailPriority.Normal;
    sc.UseDefaultCredentials = true;
    sc.Send(msg);
    msg.Dispose();

    Everything gives a 200 reply but nothing actually sends. I feel there is something in umbraco blocking smtp or a setting that needs to be configured. 

    I found this link here http://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/

    but it looks like a red herring. I also found some other links about Contour but I feel I should be able to do it raw without it.

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 07, 2014 @ 07:37
    Jan Skovgaard
    0

    Hi Dan

    Are you sure the SMTP settings are correct?

    Have you tried using SMTP4dev to test? https://smtp4dev.codeplex.com/

    Have you checked that the e-mail does not end up in the spam folder?

    Have you checked the /app_data/logs file to see if there is an error regarding the SMTP stuff? (Would be weird since it seems you get the correct status codes).

    In regards to the setting in umbracoSettings.config that is where you should define the sender e-mail btw - so try adding the e-mail from

    Looking forward to hearing from you.

    /Jan

  • dan 54 posts 133 karma points
    Nov 07, 2014 @ 21:07
    dan
    0

    My smtp settings are correct. That was the first thing I checked along with the junk mail folder. TheSMTP4dev app didn't work for me either not that it was a big deal to me.

     

    There is no email being set though I know I'm hitting the right script. Other non-Umbraco .net sites have no problem with it. The site datalogs dont tell anything regarding what is going on in the smtp. I did make the umbracoSettings.config the same before posting this thread but that doesn't appear to have a real connection to this issue.

     

     

    I took the same code and turned it into a user control so its all .net no js then tried to add that as a macro. In umbraco all it does is do a page postback and nothing gets sent. The usercontrol content is in a form tag with runat server so I know it should be working. I've already tested it on a plain.aspx page and it works perfectly.

     

    I just have no idea why this doesnt work with Umbraco.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 07, 2014 @ 22:18
    Jan Skovgaard
    0

    Hi Dan

    What version of Umbraco are you using and is it running MVC mode? If it is that's probably the reason why it does not work since you can't trigger user controls post methods in MVC even though you can render data.

    So if it's using MVC then the submit event is not working since it's a user control.

    /Jan

  • dan 54 posts 133 karma points
    Nov 08, 2014 @ 09:06
    dan
    0

    Ok so now I realize I made a huge bonehead move. Not just by making this thread but not checking how I was accessing the smtp script to begin with. The user control is still an odd issue but with my initial submit to the smtp script from JS I never checked to make sure it C# script was actually imported and was simply posting to an empty shell.

    Thanks Jan for your help.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 08, 2014 @ 09:17
    Jan Skovgaard
    0

    Hi Dan

    You're welcome - Don't be too hard on yourself. We've all been there and sometimes the only way of moving forward is asking for help and once you have done so you realise what the issue is. Know that feeling too well :) - Happy you got it figured out.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft