Make the mail body disabled in mailto js - javascript

I'm building a shooping site where the customer is ablee to contact the seller with emails.
I dont want to use backend so I just use Mailto.
now, I have 2 questions:
1) Can I open the client mail with disabled field?
So that he wont be able to change the "To" field (for example)?
I dont want to use "readonly" attribute because there are also fields that the user himself need to fill.
2) Can I send the mail from my code without the customer press "send"?
Thank you guys!

Can I open the client mail with disabled field?
No.
Can I send the mail from my code without the customer press "send"?
No.
If you want to do that, then use server-side code to send the email. You might want to use a backend, but you need one. It can be one you run on your websites server or a third-party service.

Related

How can I email the outcome of a shopping cart?

Using HTML and JS, I have developed a website that has multiple items in different pages with an "add to cart" button. I can link these to appear in the "cart" page but I don't want customers to pay just yet, I want customers to be able to click a button and make an order that will be sent out to us and we can process the order. I have tried to use the email tag for HTML:
<a href = "mailto:delicatedesigns#gmail.com?subject = Order&body = itemsInCart
</a>
Is there a way to include the contents of my cart page as the body of that email? if not, is there a plug in that would work well to make this happen?
You can send the list to the backend and setup a mail server using SMTP and then create a mail template that can be used to send the mail through the SMTP server.
Attach the list to the template and send the mail to the destination address using the SMTP server.
If you are using Java, try using the Java Mail API. This can help you set up an SMTP Server easily

How Do I Create An Email Event With Javascript

Basically i'm creating a website for a friend and he needs a "Contact Us Page", i'm using bootstrap studio and I have a page where you enter your name, and email. But i'm having trouble with the next part. I need the page to open the client's default email program to compose to a certain address with the entered name and email already in it how would one go about this?
simply do something like this
Click Here To Email!
if you want the email to be sent via a form submission you either need to setup a backend that will do that or you can use a service like https://formspree.io/
I've used them before, but I'm not certain what they're rules are about data privacy so its really up to you.

is there a way to send an email with data from input without php or javascript just pure simple html?

I have HTML form with a textbox where user enter his email - let say to register for a newsletter and a button to join.
When clicking the button I'd like to send myself an email with a constant subject like: 'a new user joined your newsletter' and in the body of the email have the text entered by the user.
So with PHP and Javascript code its possible - i'm looking for a pure html code that does the same (in my index.html file)
using <a href: mailto...> or <form action=mailto:... method=post> or <button onclick:mailto...> opens my mail application :(
Is there a way to send that email in the background (without opening the mail application) with the data from textbox in the email body?
if Yes to Q.1 then is there a way to add a fixed subject
No, there is no way you can send email using pure html. Email is sent over SMTP protocol. A browser operates in HTTP protocol. So it's not possible to send email even using pure javascript. Only server can send data using SMTP protocol.
No because you can not send an E-Mail without using an SMTP server. This server must be contacted by PHP or another server-side script (server must receive a form request and process it). You can not contact a SMTP server via pure HTML (that would be really insecure btw).
Regarding mailto: This only works if your clients have installed a mail client on their local machine. This mail client must be properly configured in order to - guess what - contact an SMTP server in order to send the mail.
However it is possible passing a subject via mailto:
https://css-tricks.com/snippets/html/mailto-links/

Simple HTML form into SQL DB using PHP, getting hammered by bots

I have a very simple HTML form which is for pre-registering for my car show. Unfortunately it has attracted the attention of spammers because there's an "address" field which they use to inject their spam URLs into.
I've added javascript form validation which says if the address field contains any slashes (like "http://") then it pops up a box telling spammers to go away.
I've added htaccess that I thought was supposed to stop users from being able to hit the PHP file which is used to submit the form into the DB without coming from my domain first.
I had recaptcha, but they were able to get around that as well so I removed it since it wasn't effective.
I know one flaw is that I can browse directly to my PHP file and it will insert a blank row into the database - how can I prevent this as well?
Does anyone have a good site or steps to take to stop these bots from hitting my form?
ReCaptcha, if well configured, should have solved your problem. There's no easy way to "go around that".
I've added htaccess that I thought was supposed to stop users from
being able to hit the PHP file which is used to submit the form into
the DB without coming from my domain first.
That's probably your problem. The bots are problem just calling the registration page with the right parameters. One way to get around it would be to display a hidden input field on your form, populate it with some random value, and check that you get the same value when the form is submitted.
But again ReCaptcha should work... if it doesn't you should ask a specific question about that.
first of all, validate the data that are send from the Form, check them if are valid, not empty. etc. If you are using a framework those have validation classes(use it), else create some,
second put back the captcha and don't send any data to the server if this isn't valid

Mail script with just JavaScript and HTML5

Is it possible to create a contact form that sends the answers by email with only HTML5 and JavaScript? And if it is, how do I do it?
I don't think it's possible to do it from JavaScript directly via a mail function or so because the user's local machine can't be assumed to be running a mail server. There would be nothing to send the email from.
I'm not sure how "standards compliant" this is, but you can navigate to (by using links or document.location) to mailto:user#example.com or so which will begin composing an email in the user's standard email client, allowing them to send you an email directly. Though this will expose both their and your email address.
In the action field of the form, set the action as “mailto:youremailaddress” for example:
<form action="mailto:myforms#mydomain.com">
If you want to send the form data as plain text you can use the following
Add ‘enctype=text/plain’ in the form attributes. The form code becomes:
<form action="mailto:myforms#mydomain.com" enctype="text/plain" >
When this form is submitted, you will get the email in readable form.

Categories