Copied to clipboard

Flag this post as spam?

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


  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 11:55
    Daniel Gottschalck
    0

    Cultiv Razor Contact form won't send email, or show error.

    HI

    When I try to send a email with Cultiv Razor Contact form (I have added a field or 2 in the chtml file, with no errors) It doesn't get send or show errors, neither in console or in VS2010...

     

    My macro is:

     

    <umbraco:Macro
                    FileLocation="~/macroScripts/CultivContactForm.cshtml"
                    MailFrom="[email protected]"
                    FormLabelName="Navn:"
                    FormLabelEmail="E-mail adresse:"
                    FormLabelPhone="Telefonnummer:"
                    FormLabelMessage="Forespørgsel:"
                    FormSentConfirmation="Tak for din forespørgsel! Vi kontakter dig snarest."
                    FormLabelSendCopy="Send mig en kopi af denne e-mail."
                    RedirectUrl="/produkter/planner/kontakt.aspx"
                    runat="server" />

     

    Web.config:

    <smtp>
      <network host="mail.edora.dk" userName="" password="" />
    </smtp>

     

    Thanks in advance

     

    Regards Daniel G.

     

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 12:02
    Sebastiaan Janssen
    0

    That looks quite okay, so I'm wondering now if you need to provide a username and password for that particular mailserver.

    Additionally, could you check the umbracoLog table to see if there's an error ("Error creating or sending contact mail, check if there is a mailFrom property on your document and that it has a value, or specify a MailFrom parameter on the macro call exception: ...") in there that might explain what's going on?

    I think you might already have tried to remove the try/catch from the SendMail function? If not, that would be a good place to start.

  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 12:29
    Daniel Gottschalck
    0

    I have tried to provide a username and password, but still no email send...

     

    I have checked the umbracoLog and I found:

    "Error creating or sending contact mail, check if there is a mailFrom property on your document and that it has a value, or specify a MailFrom parameter on the macro call exception: "

     

    As you said.

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 12:36
    Sebastiaan Janssen
    0

    And what exactly is the exception? That's the important bit, the rest I can predict because I wrote it already haha.. ;-)

  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 12:47
    Daniel Gottschalck
    0

    Yeah sorry ;) Though that is the only thing it writes, no exception :S

    I tried removing the try/catch - nothing changes..

     

     

     

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 13:19
    Sebastiaan Janssen
    0

    Not sure then. Try the serverless technique described in the documentation:

      <system.net> 
        <mailSettings> 
          <smtp deliveryMethod="SpecifiedPickupDirectory" from=""> 
            <network host="localhost" /> 
            <specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot" /> 
          </smtp> 
        </mailSettings> 
      </system.net> 
     

    Make sure that C:\inetpub\mailroot is has modify rights for your application pool user. This should rule out SMTP related problems.

  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 13:42
    Daniel Gottschalck
    0

    Inserted your snippet, and I got this error in the umbracoLog

     

    Error creating or sending contact mail, check if there is a mailFrom property on your document and that it has a value, or specify a MailFrom parameter on the macro call exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\inetpub\mailroot\c3355b1d-eaed-4514-9316-038a2da0facf.eml'.     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)     at System.IO.FileStream..ctor(String path, FileMode mode)     at System.Net.Mail.SmtpClient.GetFileMailWriter(String pickupDirectory)     at System.Net.Mail.SmtpClient.Send(MailMessage message)

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 13:43
    Sebastiaan Janssen
    0

    Does the directory c:\inetpub\mailroot exist? And does your application pool user have modify rights on it?

  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 13:56
    Daniel Gottschalck
    0

    Ive tried editing the application pool's identity to NetworkService instaed of ApplicationPoolIdentity.

     

    But the umbracoLog still says that it is denied for that directory.

    So for the folders permission I added NetworkService... and now, no stuff in umbracoLog, but the email, where does it appear?

     

     

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 14:09
    Sebastiaan Janssen
    0

    For the application pool identity you can use the IIS_IUSRS group.

    The email will be a file, like you saw in the error, looks a bit like this: C:\inetpub\mailroot\c3355b1d-eaed-4514-9316-038a2da0facf.eml

    This file can be opened in notepad, outlook or windows live mail to see.

    Anyway, if it is trying to write the file at all then it means that nothing else went wrong, so your problem is definitely your smtp settings. You should try and find out what credentials are needed for mail.edora.dk or set up your own mail server (but I can't help you with that). There's also instructions in the documentation for using gmail as a relay server that should work with any gmail account.

  • Daniel Gottschalck 14 posts 34 karma points
    Nov 22, 2011 @ 15:10
    Daniel Gottschalck
    0

    I have sorted it out, the credentials provided before was wrong, so I created a new user that it accepted, and everything works.

     

    Thanks for your time and help

     

     

    Regards

  • Sebastiaan Janssen 4985 posts 15098 karma points MVP admin hq
    Nov 22, 2011 @ 16:07
    Sebastiaan Janssen
    0

    Ah great, glad you got it fixed in the end.

Please Sign in or register to post replies

Write your reply to:

Draft