sendemail.php- how can i make the php script to sent email -
this question has answer here:
i using contact form in website , want send email through this. got sendemail.php
script , integrated website. when filled form , sent it, shows email sending , forever. how can make send email. need host in website? have in system , have test mail function before host website. here php script.
<?php $name = @trim(stripslashes($_post['name'])); $from = @trim(stripslashes($_post['email'])); $subject = @trim(stripslashes($_post['subject'])); $message = @trim(stripslashes($_post['message'])); $to = '<myemail@domain.com>';//replace email $echo =("thank contacting us!"); $headers = array(); $headers[] = "mime-version: 1.0"; $headers[] = "content-type: text/plain; charset=iso-8859-1"; $headers[] = "from: {$name} <{$from}>"; $headers[] = "reply-to: <{$from}>"; $headers[] = "subject: {$subject}"; $headers[] = "x-mailer: php/".phpversion(); mail($to, $subject, $message, $headers); die;
the php mail()
function try send email using whatever mail server have pointed in php.ini
.
so, mail()
work on local machine need set local mail server.
Comments
Post a Comment