-1

I really don't understand how Php works and i am a little nervous, i don't like the idea of using more application for a email-send system. Is there anyway to do that without php, only in javascript/html/css? Can someone explain how this works or if is there something i need to know?

I tried to find on google, but i didn't find anything useful. Thanks in advance! :)

TheUltra0
  • 9
  • 3
  • 1
    You can create a hyperlink that uses the `mailto:` protocol, which would cause that user's default email client to open and a new email that is pre-addressed to the specified address will be created. You can even specify a subject to be auto-filled in. `Email me` – Scott Marcus Jun 02 '21 at 17:14
  • A browser (and thus JavaScript running within it) cannot directly send email, it does not have the necessary ability. Don't be nervous about PHP - server-side programming languages such as that are a completely normal and everyday part of web programming. It you want to be a web developer you'll soon get used to using them. – ADyson Jun 02 '21 at 17:18
  • Thank you. It's hard for me to understand all of this, i saw many different videos on youtube, i installed 2 apps (MAMP and Xampp), and i still have issues to use them. I'll try to resolve it, thank you :) – TheUltra0 Jun 02 '21 at 17:24
  • No problem. You can ask a more specific question about your code and setup, if you need to, just create another post with more exact details of the problem – ADyson Jun 02 '21 at 17:32
  • It's possible with JavaScript in the browser but it's much simpler with a backend. – Thomas Sablik Jun 02 '21 at 17:37
  • @ThomasSablik possible how, exactly? Browser can only make a mailto link, that isn't sending an email – ADyson Jun 02 '21 at 17:40
  • @ADyson browsers can send TCP packets https://stackoverflow.com/questions/12407778/connecting-to-tcp-socket-from-browser-using-javascript E.g. you can implement IMAP and SMTP in your Chromium – Thomas Sablik Jun 02 '21 at 17:40
  • @ThomasSablik that info is out of date as far as I can see. I can't see any current info which suggests what you claim. The tcp socket standard was never adopted, and all content about it on MDN is in the "obsolete" section of their archive. For Chrome it might work - but for extensions only? Do you have any current references you can link to? Even if it was, no-one would use it for email because the smtp credentials would need to be effectively public - stored in the browser code somewhere (unless you prompt the user for their own, but that's probably not what most web app developers want). – ADyson Jun 02 '21 at 18:16
  • @ThomasSablik ...the most I can find regarding Chrome is a proposal very recently, nothing concrete yet: https://bugs.chromium.org/p/chromium/issues/detail?id=1119620&q=udp&can=2 . Nothing from the other browsers. – ADyson Jun 02 '21 at 18:20
  • @ADyson No, I don't have a current reference. There is a difference between "it's not possible" and "you shouldn't do this". If you tell your client something is not possible and they show you how it is possible. In the question it's unclear if this about a public web app or about a private email app. – Thomas Sablik Jun 02 '21 at 18:23
  • @ThomasSabik it sounds more like a beginner trying to figure out the basics of the web, not sure they've thought that far yet. Anyway I'd say that a technology which is either obsolete or experimental or merely proposed isn't ready for real life use, so I certainly wouldn't be telling any clients this was possible at the moment. It's even niche enough that beginner programmers don't need to know about it for the time being. They can learn if/when it becomes fully available. – ADyson Jun 02 '21 at 18:27
  • @ADyson We could probably discuss the whole day about it. In my opinion it should be mentioned on a Q&A platform like Stackoverflow because the target is not the one user asking the question but future users searching for this topic. In your opinion it shouldn't be mentioned and I accept it. I wouldn't try to convince you. – Thomas Sablik Jun 02 '21 at 19:05

1 Answers1

0

Sending mail requires a program to run on a server, and PHP is a language that can talk to a server. You can't send an email using just HTML, CSS and Javascript.

Jonny
  • 27
  • 4
  • While in the strictest sense that is true, you can "generate" an email with just HTML. Then, the email client on the system would do the actual sending. – Scott Marcus Jun 02 '21 at 17:12
  • 1
    This answer is wrong. Client side JavaScript allows sending TCP packets to an email server: https://stackoverflow.com/questions/12407778/connecting-to-tcp-socket-from-browser-using-javascript It's not common or convenient but possible. – Thomas Sablik Jun 02 '21 at 17:31