Code is working fine without attachments. and attachment code is working fine on another page anybody can help to solve this? <?php
require('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "[email protected]";
$mail->Password = "Guildsconnect";
$mail->Host = "webs10rdns1.websouls.net";
$mail->Mailer = "smtp";
$mail->SetFrom($contact_email, $contact_name);
$mail->AddReplyTo($contact_email, $contact_name);
$mail->AddAddress("[email protected]");
$mail->Subject = $sub1;
$mail->WordWrap = 80;
$mail->MsgHTML($emailbodyis);
foreach ($_FILES["attachment"]["name"] as $k => $v) {
$mail->AddAttachment( $_FILES["attachment"]["tmp_name"][$k], $_FILES["attachment"]["name"][$k] );
}
$mail->IsHTML(true);
if(!$mail->Send()) {
$_SESSION["error"] = "Problem in Sending Mail.";
} else {
$_SESSION["success"] = "Mail Sent Successfully.";
}
?>
CodePudding user response: