Code

Discussion on Asp.net Contact Form - HTML Email (Bootstrap Edition)

mimtiyaz

mimtiyaz supports this item

Supported

This author's response time can be up to 1 business day.

25 comments found.

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!! :)

That’s great

Can this be done using the System.Net.Mail my hosting will not let this go through

Hello,

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.

vtonian

vtonian Purchased

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.

Additional info: - In my Contact.aspx page, I copied over your Container and JavaScript sections, per instructions but commented out the <script src=”... lines as they load in my Site.Master - 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.

Thanks much.

vtonian

vtonian Purchased

I may have solved this, changed the properties of reCAPTCHA.cs Build Action from Content to Compile. It’s running now.

vtonian

vtonian Purchased

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.

vtonian

vtonian Purchased

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…

vtonian

vtonian Purchased

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.

Great!

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey