here is my code i want to ssend email through php.
this is my code but mail function is not working properly. and it is showing error of : Mailer error could not instantiate mail function.
<?php
require_once('PHPMailer/class.phpmailer.php');
$frompage= $_REQUEST['frompage'];
if($frompage=="contact"){
$mname= $_REQUEST['mname'];
$mmobile= $_REQUEST['mmobile'];
$memail= $_REQUEST['memail'];
$gemail= str_replace("atsymbol","@",$memail);
$mcomment= $_REQUEST['mcomment'];
$body = file_get_contents('email-template.html');
$body = eregi_replace("<mfrompage>" , $frompage, $body);
$body = eregi_replace("<mname>" , $mname, $body);
$body = eregi_replace("<mmobile>" , $mmobile, $body);
$body = eregi_replace("<memail>" , $gemail, $body);
$body = eregi_replace("<mcomment>" , $mcomment, $body);
}
if($frompage=="career"){
$mname= $_REQUEST['mname'];
$mmobile= $_REQUEST['mmobile'];
$memail= $_REQUEST['memail'];
$gemail= str_replace("atsymbol","@",$memail);
$mcomment= $_REQUEST['mcomment'];
$body = file_get_contents('email-template2.html');
$body = eregi_replace("<mfrompage>" , $frompage, $body);
$body = eregi_replace("<mname>" , $mname, $body);
$body = eregi_replace("<mmobile>" , $mmobile, $body);
$body = eregi_replace("<memail>" , $gemail, $body);
$body = eregi_replace("<mcomment>" , $mcomment, $body);
}
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->AddReplyTo($gemail,$mname);
$mail->SetFrom($gemail,$mname);
$address = "yogeshkamboj123@gmail.com"; //where email need to be sent
$mail->AddAddress($address);
// $mail->AddCC("shweta.ohlyan@vermillion.net.in", "shweta.ohlyan@vermillion.net.in");
$mail->Subject = "Query from website Vermillion.net.in";
//$mail->AltBody = "This is for text based email"; // optional
//$mail->Body=$body;
$mail->MsgHTML($body);
// $mail->AddAttachment("images/phpmailer.gif"); // attachment
// $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent sucessfully!";
}
?>
this is my code but mail function is not working properly. and it is showing error of : Mailer error could not instantiate mail function.