Copied to clipboard

Flag this post as spam?

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


  • Dan 1288 posts 3921 karma points c-trib
    Jun 25, 2010 @ 14:32
    Dan
    0

    Send mail using local IIS SMTP

    Hi,

    I'm hosting a site, but only by means of the www A record pointed to my server.  The site has a contact form which uses umbraco.library:SendMail() to generate an enquiry email to an administrator.

    Trouble is, because I'm not hosting the mail service on this domain, simply adding host/username/password settings in the mail config settings in web.config results in no mail being sent.  What I need to do is drop the mail into the C:\Inetpub\mailroot\Pickup directory, from where the local SMTP service will deal with it.

    Question is, how do I set this up.  Are there some settings in web.config I can use, or will it require more serious hacking?

    Thanks!

  • Dan 1288 posts 3921 karma points c-trib
    Jun 25, 2010 @ 15:00
    Dan
    0

    To add... I've tried the following:

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

    But nothing seems to make it into the pickup directory at all.

    Any ideas?

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jun 25, 2010 @ 16:11
    Stefan Kip
    0

    Have you checked the umbracoLog table?

  • Dan 1288 posts 3921 karma points c-trib
    Jun 25, 2010 @ 16:41
    Dan
    0

    Yeah, nothing gets written into there when I submit the form.  Should it?

    Edit: actually, I've tried a few times now and the following has appeared in the log:

     

    umbraco.library.SendMail: Error sending mail. Exception: System.Net.Mail.SmtpException: Failure sending mail. ---> System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\mailroot\Pickup\b317f6d1-77d7-4185-92a6-f86374da32ea.eml' is denied.
       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)
       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)
       --- End of inner exception stack trace ---
       at System.Net.Mail.SmtpClient.Send(MailMessage message)
       at umbraco.library.SendMail(String FromMail, String ToMail, String Subject, String Body, Boolean IsHtml) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\presentation\library.cs:line 1800

     

    Does anyone know how I get around this permissions issue?

    Thanks

  • Dan 1288 posts 3921 karma points c-trib
    Jun 25, 2010 @ 17:52
    Dan
    0

    I've just tried ditching this approach and using gmail as an SMTP server instead, with the following settings:

    <smtp from="[email protected]" deliveryMethod="Network">
    <network host="smtp.gmail.com" port="25" userName="[email protected]" password="mypassword" />
    </smtp>

    Still nothing.  No error in the log (unless something is caching and the errors aren't being generated?) and no mail at the recipient.

  • Max Mumford 266 posts 293 karma points
    Oct 04, 2010 @ 17:20
    Max Mumford
    0

    Hi,

    its probably way to late but for anybody else's reference, it seems like gmail dosn't work with SMTP in umbraco - I used my gmail settings and got an error logged saying: "5.7.0 Must issue a STARTTLS cmmand first". Somebody tell me if I'm wrong :)

    Max.

  • Jorge Ruiz Caro 9 posts 29 karma points
    Dec 16, 2010 @ 03:34
    Jorge Ruiz Caro
    0

    Hey Max, i think the problem with gmail is https config. I'll tried it and it works with cultivform. But i'm having problems with the umbraco send to publish.

    Jorge

  • Jorge Ruiz Caro 9 posts 29 karma points
    Dec 16, 2010 @ 14:22
    Jorge Ruiz Caro
    0

    My problem was solved thanks the post Users and Send to publish. Really important the advice about the notifications, you can find that option in the contextual menu in any page of the content site.

    Greetings.

    Jorge

Please Sign in or register to post replies

Write your reply to:

Draft