Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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" />
<smtp> <network host="mail.edora.dk" userName="" password="" /></smtp>
Thanks in advance
Regards Daniel G.
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.
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.
And what exactly is the exception? That's the important bit, the rest I can predict because I wrote it already haha.. ;-)
Yeah sorry ;) Though that is the only thing it writes, no exception :S
I tried removing the try/catch - nothing changes..
Not sure then. Try the serverless technique described in the documentation:
<smtp deliveryMethod="SpecifiedPickupDirectory" from="">
<network host="localhost" />
<specifiedPickupDirectory pickupDirectoryLocation="C:\inetpub\mailroot" />
Make sure that C:\inetpub\mailroot is has modify rights for your application pool user. This should rule out SMTP related problems.
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)
Does the directory c:\inetpub\mailroot exist? And does your application pool user have modify rights on it?
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?
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.
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
Ah great, glad you got it fixed in the end.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted