Hi,
I’m hosting a website, but only the www A record is pointing to my server. The site has a contact form which is supposed to trigger an email to an administrator.
Trouble is, because I’m not using the email service on this domain, I can’t simply use the SMTP settings in my config files, as there is no SMTP service on this server for this domain. I’ve contacted the people hosting the mail on this domain and they don’t support external connections on the Exchange server.
So I need to be able to use the SMTP service on my server to send mail on behalf of this domain.
I’ve tried putting test .txt file into C:\Inetpub\mailroot\Pickup and it sends fine, so the SMTP service is definitely running. However, when I try to send a mail from the contact form on the website, this gets written into the error log:
mycms.library.SendMail: Error sending mail. Exception: System.Net.Mail.SmtpException: Failure sending mail. —> System.UnauthorizedAccessException: Access to the path ‘C:\Inetpub\mailroot\Pickup\0fce8ff3-545a-4889-b373-787438b1b4e1.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 mycms.library.SendMail(String FromMail, String ToMail, String Subject, String Body, Boolean IsHtml) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\mycms\presentation\library.cs:line 1800
So there’s a permissions problem in writing from the web app to the pickup directory.
Does anyone know how to overcome this without opening up my server to spammers?
Any help very much apprecaited!
Thanks…