This author's response time can be up to 1 business day.
How do you tie this using Office 365 mail client? I have added smtpClient.enableSSL=”true” and that allows communication but I get an error of 5.3.4 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 16.55847:69000000, 17.43559:0000000060010000000000000000000000000000, 20.521
Actually I found a post that claims Microsoft simply doesn’t allow this functionality
Final update, I contacted Microsoft and they were kind enough to walk me through the process of tying this form to Office 365! It can be done and works great! I did have to add a param for smtpClient.EnableSsl = true; to enable TLS of course, for me line 53 just before .Send(message) on default.aspx.cs. I then followed the instructions from the MS URL to send via client. https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-3
Final step was to add jquery-3.3.1.js to the js folder and update the link on line 112 for Default.aspx. That did the trick!
up and running and working great!
Wonderful job on the code and the form!!
Can this be done using the System.Net.Mail my hosting will not let this go through
Am I able to place this in my regular HTML page?
Currently, even navigating to the Email_v2.0.html file doesn’t show me the form.
Thanks in advance
I’m unable to access the URL which you’ve shared.
Pretty sure this is just my lack of experience but if you can help me here, I would gladly post my docs for implementing this, and maybe it would help some other dufus in a similar situation…
I’m trying to test this in a VS 2019 ASP.NET Web Application C# before implementing it in a new site. The simple instructions didn’t work so I’ve been trying to sort out the issues one at a time, I think I’m getting close.
When I click on my Conatct.aspx page, the current error I get is is: ‘CS1061: ‘contact_aspx’ does not contain a definition for ‘btnSendEmail_Click’ and no accessible extension method ‘btnSendEmail_Click’ accepting a first argument of type ‘contact_aspx’ could be found (are you missing a using directive or an assembly reference?)’
I don’t see any references to btnSendEmail_Click in your solution that aren’t in mine, so I’m assuming I’ve missed an important step somewhere else.
Also, in VS’s Error List, there is: ‘CS0103 The name ‘reCAPTCHA’ does not exist in the current context’, referencing a line in my Contact.aspx.cs file.
I’ve copied your reCAPTCHA.cs file from your App_Code folder and tried it both in there and in my App_Start folder, same result.
In VS, when I hover over ‘reCAPTCHA’ I get the potential fixes list, which suggest creating various internal or private classes, whereas in your reCAPTCHA.cs, it’s a public class, so I’m thinking my solution hasn’t actually run my reCAPTCHA.cs.
- In Global.asax.cs, I added:
ScriptManager.ScriptResourceMapping.AddDefinition(“recaptcha”, new ScriptResourceDefinition
Path = “https://www.google.com/recaptcha/api.js”
- And then in Site.Master, ScriptManager, I added:
<asp:ScriptReference Name=”recaptcha” />
I don’t know if the reCAPTCHA and btnSendEmail_Click errors are related but I’m hoping you’ll have an idea or maybe can point me to where I should be doing more research to sort this out. I think this could be my go-to contact form solution for several sites if I can get it to go.
I may have solved this, changed the properties of reCAPTCHA.cs Build Action from Content to Compile. It’s running now.
I am getting the ‘Please confirm that you are not a robot’ error and no email is being sent. I’ve put my site key in the default.aspx and default.aspx.cs, where indicated by “[YOUR SITE KEY]” but inside the quotes and w/o the brackets.
You need to specify the site key within the quotes (No brackets are required).
Yes, as I said, I’ve done that but still get the error
BTW, thank you for the prompt response. I just tried it now using the secret key instead of the site key in the default.aspx.cs and got a ‘Faulure sending mail’ error.
... and just tried commenting out the recaptcha code per your suggestion to the unfortunate mr. pdeignz and also got the Failure sending mail’ error. The mail is handled by gmail, fwiw and I’d be sure I have my webconfig in order but the clouds of doubt are darkening…
...tried updating the jquery and adding the EnableSsl = true per mr. WebWaxNet, still same error
Ah, think I may have got it, changed webconfig host from gmail.com to smtp.gmail.com
And then, figured out that I had to use (and modify) the Email_v2.0.html, after googling StreamReader. Looking back, i see you only claim this has ‘simple code’, not that it is easy for dummies to use. FWIW, I think you’d pick up some more sales if you wrote up some new, detailed instructions for the ignorant masses, folks such as myself. Perhaps it’s not worth the return but this was by far the best looking option I ran across when needing a form for my simple sites.
Ok, back to work, see if I can finish this up today…
FWIW to future stumblers, the last hurdle was, since I was using gmail, they were blocking it as mail from an unknown device, so logging into my server and signing in to the gmail account from there let me get that approved. It seems to all be working fine now.
I recently purchased your asp.net contact us form/code, and I’m having some issues with the email relay portion. Captcha appears to be working okay, but when I try to send through Office 365, the screen form submission just flashes with no result one way or another, and the email is never sent. I’ve updated the web.config file for smtp.office365.com with SSL enabled and the correct username and password, but it doesn’t seem to work.
I’d try to debug it through Visual Studio, but the solution won’t load in VS 2019, so I’m at a dead end, and I’m hoping you can offer some quick advice.
HelloUsually, this issue arises when the SMTP in web.config is not configured properly. Check out the prerequisites if smtp.office365.com is used. https://www.netwoven.com/2015/12/24/smtp-relay-for-office-365exchange-online/
Hope this will fix your issue.
Good luck with your sales
Use, by you or one client, in a single end product which end users are not charged for. The total price includes the item price and a buyer fee.
View license details
Price is in US dollars and excludes tax
Deliver better projects faster. Web, design & video assets
Unlimited downloads, from $16.50/month
Effortless design and video. Made online by you.
Smart templates ready for any skill level.
Designers matched perfectly to
you on Envato Studio
2000 artists ready to undertake your work