0

The webpage should consist only of buttons, which - when they are clicked - an email with a specific subject line and a specific email recipient is sent. This should happen in the background without the need to open the email client and send manually.

So it is a combination of a "contact us"-button without the form fields to enter and a submit button.

I appreciate your input.

Pang
  • 9,564
  • 146
  • 81
  • 122
  • Please include code examples of what you have tried that is not working. If you have not tried anything, then you have not done enough to justify asking a question. – lax1089 May 15 '17 at 17:36

3 Answers3

0

You will need to use a java script AJAX method to do this - it is not trivial.

Somewhere on your server needs to a file in whatever language you are using (likely php) to send the email. The AJAX method will be attached to the button in question.

AJAX is the only way to achieve this without refreshing the page!

Community
  • 1
  • 1
R_Tobes
  • 69
  • 1
  • 9
0

It is not considered good practice to automatically send an email from someone else' account without giving them a chance to preview what they will be sending. For all they know they could be sending spam mail.

To pre fill the To, Subject and Body of the email you can look at the documentation here: Link

Here is a quick example:

<a href="mailto:webmaster@example.com?subject=Mail from Our Site&body=Body%20Text"><button class="my_button"></button></a>

samroberts707
  • 161
  • 2
  • 16
  • Thank you for your answer, as stated in my answer in a previous post, it will be an internal webpage with only internal people having access to and the email addresses (recipients) will be members of the internal page. I have checked also your code, and it does open the mail client which I would like to avoid to save this step. – Beachboat May 16 '17 at 06:59
0

Some good answers in here, what nobody mentioned yet is that you also need to make sure these buttons are not abusable. If this is something users of your website have access to, you might want to set a certain limit as to how many per hpur can be send or include a captcha.

fstam
  • 669
  • 4
  • 20
  • Thank you for your answer, it will be an internal webpage for a kind position reporting, so abuse is not an issue here. – Beachboat May 16 '17 at 06:57