0

PHP Mailing

Hi guys im stranded with my codes. i created a contact form and want to link it to my email. Source code: <?php if(isset($_POST['submit'])){ $name=$_POST['nme']; $email=$_POST['email']; $contact=$_POST['contact']; $msg=$_POST['msg']; $to='chrisvix.media@gmail.com'; $subject='Form Submission'; $message="Name :".$name."\n"."Contact:".$contact."\n"."Wrote the following :"."\n\n".$msg; $headers="From: ".$email; if(mail($to, $subject, $message, $headers)){ echo "<h1>Sent Successfully! Thank you"." ".$name.", We will contact you shortly!</h1>"; } else{ echo "Something went wrong!"; } } ?> after i wrote my php code for that function . When i run it it shows me a blank page. it doesnt display any error message or success message. And it doesnt send anything to my email eigther. Please help me out. Your contributions would be greatly appreciated.

6th Jun 2017, 2:30 PM
Peter Claver
Peter Claver - avatar
7 Answers
0
Where did you test your code?
6th Jun 2017, 2:35 PM
CalviŐ˛
CalviŐ˛ - avatar
0
on 000webhost
6th Jun 2017, 2:36 PM
Peter Claver
Peter Claver - avatar
0
For gmail sender, you need to set host and port.
6th Jun 2017, 2:39 PM
CalviŐ˛
CalviŐ˛ - avatar
0
how do i do that please
6th Jun 2017, 2:40 PM
Peter Claver
Peter Claver - avatar
0
Better use Phpmailer. More information check out this site https://www.sitepoint.com/sending-emails-php-phpmailer/
6th Jun 2017, 2:48 PM
CalviŐ˛
CalviŐ˛ - avatar
0
im checking it out
6th Jun 2017, 2:49 PM
Peter Claver
Peter Claver - avatar
0
its kind of compicated
6th Jun 2017, 3:03 PM
Peter Claver
Peter Claver - avatar