The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> create a button in a website for a form Email(subject and body done already)
fregon
post Aug 4 2017, 11:45 PM
Post #1





Group: Members
Posts: 3
Joined: 4-August 17
Member No.: 26,471



Hi,

I don't know if this is possible but I am trying to create button for my website that when pressed would create an outlook email.
Just like when you click an email address on a website would do.

The difference is that I don't want a blank email.
This is basically what I want to see in the email.
----------------------
From: (the customers email address, automatically inserted because it is the customers outlook)
To: (my email address that is inserted automatically by html code)
Subject: Questions regarding item stock (inserted automatically by html code)

Body: (inserted automatically by html code)
Please fill in the following questions.
Name:
Phone number:
email address:
item product number:
item product name:
Your question:

Thank you.
----------------------

So basically the customer just needs t fill in the email and press send.
Our email address, email subject and email body is ready from the beginning.

Could someone tell me how to create such a button please.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 5 2017, 12:50 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



This would require a server side script to send the e-mail. First you would create a <form> with inputs for each field. You also need a submit button to send the data to the server script for processing. Don't forget you still need to validate your data, make sure required data is not left blank.

There are many ready to go 'Contact Us' scripts available on the web. You could modify one to fit your needs. Try a Google search.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
fregon
post Aug 5 2017, 01:22 AM
Post #3





Group: Members
Posts: 3
Joined: 4-August 17
Member No.: 26,471



Thank you CharlesEF for your reply,

But I don't think you understood what I want.
Have you ever clicked a email address in a website, and then your outlook email opens up with that email address you clicked is inside the "To:" part?
But the subject and the body of the email is blank.
Well I would like it to be not a blank email.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 5 2017, 02:11 AM
Post #4


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Oh, sorry. I don't think you can do that with a button. In fact what you need is called a mailto link. You can use a <a>, like this:
CODE
<a href="mailto:someone@example.com?Subject=Hello%20again" target="_top">Send Mail</a>
This method only works if the user has a e-mail client installed on their computer. That is why it is better to use a web based 'Contact Us' form.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
fregon
post Aug 5 2017, 03:39 AM
Post #5





Group: Members
Posts: 3
Joined: 4-August 17
Member No.: 26,471



Yes this is what I was looking for.
Thank you.
I didn't know about the mailto code.

I also found how to put messages into the body of the email by using this
&amp;body=The main text of the email is here" target="_top">Send Mail</a>

The thing is hat I want to make the body of the email to look like this:
Please fill in the following questions.
Name:
Phone number:
email address:
item product number:
item product name:
Your question:

But what I get looks like this:
Please fill in the following questions.Name:Phone number:email address:item product number:item product name:Your question:

Typing in <br> doesn't work since it just shows up into the email itself.

I knwo its a slim hope but is there a solution to this?





User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Aug 5 2017, 04:47 AM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



You can use three parameters in the query string with mailto: subject, body and cc. So what you want can, technically, be done. Note that spaces and linebreaks need to be URL encoded though.

CODE
mailto:you@example.com?subject=Questions%20regarding%20item%20stock&body=Please%20fill%20in%20the%20following%20questions.%0D%0A%0D%0AName:%0D%0APhone%20number:%0D%0Aemail%20address:%0D%0Aitem%20product%20number:%0D%0Aitem%20product%20name:%0D%0AYour%20question:



That doesn't mean it will work. There must be en email client installed and the browser must be configured to use it. mailto has always been unreliable because of this (and more) and is so even more today when many people use webmail exclusively. Neither will it work if the user uses a public computer or someone else's machine. Well, in the last case it maybe will work, but it won't be the intended email account that's used.

As CharlesEF said, use a script if it is of any importance to you.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 04:59 PM