Click here to Skip to main content
15,918,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends
I am Sarfaraz. I am developing a small website in HTML/CSS but i have to add an email sending option on the page. I know it is possible with in PHP and Asp.net etc. I tried but it is displaying errors. Could you please help me in writing this piece of code or if you have any reference on the internet.
Thank you
Sarfaraz
Posted

PHP
<?php <br mode="hold" /?>$to = "xxx@gmail.com";//try with ur mail id
$subject = "My subject";
$txt = "Hello";
$headers = "From: xxx@gmail.com" ;
ini_set("smtp_port",25);
mail($to,$subject,$txt,$headers);

?>




hi try this
 
Share this answer
 
First of all, the built-in php mail[^] function is sometimes not reliable, but the biggest problem is that you need php.ini level configuration. In a hosted environment you either have set it up or not, you can ovverride on host level or not... so I suggest to switch to PHPMailer[^], here is a short tutorial how to use it with gmail as smtp relay: http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900