How is PF's "CONTACT US" Button made?

In summary, PF's "Contact Us" button uses a different method that works on any computer, with any type of email client.
  • #1
YoungPhysicist
Insights Author
350
203
I would like to add a email sending feature to my website, something like the the "CONTACT US" button here on PF.
test.png

When I was searching this topic online, I get various paragraphs from CodeProject and StackOverflow, I saw methods using mailto: and some other stuff, but none of those work on my new laptop. Windows says that it needs an email client.

But as I am trying to use the "CONTACT US" button here on the exact same computer, it worked! So it uses a totally different method that works everywhere.

Do anyone have a idea of how it was made?
 

Attachments

  • test.png
    test.png
    26.9 KB · Views: 677
Technology news on Phys.org
  • #3
The Contact button brings up a dialog that sends your message back to PF's server just like any other action on the site (like clicking a link). A mailto link uses information on your computer to open whatever email program (like Outlook) has been set up as default on your computer. In order to send email with that, you have to have your email program set up to communicate with an email server. For most people, this is provided by your ISP or a service like gmail. If you don't have an email program set up, your computer can't use the mailto link.
 
  • Like
Likes jedishrfu
  • #4
Google blogger software uses a dialog with the google host to forward your message to the owner of the blog. That means the google machine takes on the responsibility of being the one with the email client.

There may be some javascript apis from google that would allow that for a custom web application.

Aso this scheme might work:

https://www.makeuseof.com/tag/7-simple-steps-gmail-desktop-email-client/
 
  • Like
Likes YoungPhysicist and Borg
  • #5
Young physicist said:
Do anyone have a idea of how it was made?
It seems you are asking a couple questions. First the popup is a combination of a little javascript and some css. Javascript detects the click and then loads the contact form overlay. The email is sent via html form.
 
  • Like
Likes YoungPhysicist
  • #6
Greg Bernhardt said:
The email is sent via html form.
Yeah,I know. I mean which way exactly is the form constructed,so it works everywhere.Like the source code or something (the “view source code”’ function on my browser didn’t help much)

But according to what @jedishrfu said in the previous post,looks like it can’t be done only by html.It has to work with some email client,either on the computer or external.
 
  • #7
Young physicist said:
Yeah,I know. I mean which way exactly is the form constructed,so it works everywhere.Like the source code or something (the “view source code”’ function on my browser didn’t help much)

But according to what @jedishrfu said in the previous post,looks like it can’t be done only by html.It has to work with some email client,either on the computer or external.
Not sure what you are really getting at. The form has nothing to do with an email client.
 
  • Like
Likes QuantumQuest
  • #8
Young physicist said:
It has to work with some email client,either on the computer or external.

It works with a program on the server side that sends email using the information submitted with the HTML form. It doesn't interact with any email software on the client computer.
 
  • Like
Likes QuantumQuest
  • #9
Young physicist said:
I saw methods using mailto: and some other stuff, but none of those work on my new laptop. Windows says that it needs an email client.

Yes, a mailto: url basically tells your browser "load whatever the default email client program is on this computer and start composing a new email with this to address". But that's not what PF's "Contact Us" button is doing, as should be obvious if you hover your mouse over it to look at the URL it points to.
 
  • #10
SMTP (Simple Mail Transfer Protocol) is invoked on the physical machine that hosts the forum. So when you send email, there has to be:

A DNS connection to resolve the destination URL reference (example: me@mycompany.com) into an octet string which is the internet actual address.
An smtp process (mail server) that takes the message and uses the mail protocol to connect to the smtp process "mycompany.com" uses to receive email.
It initiates a conversation, which you can actually emulate from a telnet terminal. Try it. It is how you test an email (Exchange in windows parlance) server.

https://docs.microsoft.com/en-us/exchange/mail-flow/test-smtp-with-telnet?view=exchserver-2019

This shows the Windows how to. If you really want the nitty gritty stuff you probably should run WSL ubuntu (Linux Windows Service) which provides a pretty good embedded version of Linux. Requires Windows 10 and is free. I am assuming you are not using Linux to start with.

Most email messages use some type of encoding protocol. So to actually send a readable "cool" email, rather than simply test a connection, you need to run base64 (or windows version of it) on a candidate file - usually html. Then send the encoded file.

I've left out details.
 
  • #11
Here, you can find the source code for a simple contact form using HTML and PHP.

PHP is a popular server-side language that can read the input values the user sent (found in the array $_POST) and can send email with the function mail($to, $subject, $body, $from).
 
  • #12
Greg Bernhardt said:
Not sure what you are really getting at. The form has nothing to do with an email client.

PeterDonis said:
It works with a program on the server side that sends email using the information submitted with the HTML form. It doesn't interact with any email software on the client computer.
Well,sorry. I mistreated this question. I thought that the contact button can be made simply by html code and nothing else.

Later I thought that it can be used by using a gmail client.

At last, thanks to @PeterDonis, I know what it really is.
 

1. How is the "CONTACT US" button created?

The "CONTACT US" button is created using HTML code, specifically the <button> tag. This is then styled using CSS to achieve the desired appearance.

2. What programming languages are used to make the "CONTACT US" button?

The "CONTACT US" button is typically made using a combination of HTML, CSS, and JavaScript. These languages work together to create the button and its functionality.

3. How is the button linked to the contact page?

A link is added to the button using the <a> tag in HTML. This link is then directed to the contact page using the appropriate URL.

4. Can the appearance of the button be customized?

Yes, the appearance of the button can be customized using CSS. Different styles can be applied to the button, such as changing the color, font, and size to match the design of the website.

5. Is the "CONTACT US" button accessible on all devices?

Yes, the "CONTACT US" button can be made to be responsive and accessible on all devices by using appropriate HTML and CSS code. This ensures that the button is visible and functional on different screen sizes and devices.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Computing and Technology
Replies
3
Views
1K
  • General Discussion
Replies
1
Views
861
Replies
15
Views
1K
  • Programming and Computer Science
Replies
15
Views
6K
  • Programming and Computer Science
Replies
6
Views
4K
  • Other Physics Topics
Replies
11
Views
23K
  • Beyond the Standard Models
Replies
0
Views
471
  • Feedback and Announcements
Replies
12
Views
1K
  • Programming and Computer Science
Replies
4
Views
6K
Back
Top