Contact form | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Contact form

Hi all How do I connect my website contact form directly to my email inbox ?

4th Sep 2018, 7:25 PM
Arik Shamailov
Arik Shamailov - avatar
3 Answers
+ 3
Hi Arik Shamailov, use the action attribute of the form tag. <form action="mailto:yourmail@mail.com" method="GET" > Or use it external with PHP <form action="mail.php" method="POST" > <?php $subject = "Your subject"; $msg = "First line of text\nSecond line of text"; $msg = wordwrap($msg,70); mail("yourmail@mail.com",$subject,$msg); ?> Additional: https://php.net/manual/en/function.mail.php
4th Sep 2018, 7:53 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 1
Thank you Vincent
4th Sep 2018, 8:51 PM
Arik Shamailov
Arik Shamailov - avatar
0
In additional: You can use inline-CSS in your PHP $msg if you want to style your mail. Here is an example how to implement JS, Inline-CSS and HTML in PHP. But get rid of the echo if you want to use it for mail();👍 https://code.sololearn.com/wo17mZq7SNJE/?ref=app
4th Sep 2018, 9:40 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar