How do I prevent mails sent through PHP mail() from going to spam? [duplicate]

You must to add a needle headers: Sample code : $headers = “From: myplace@example.com\r\n”; $headers .= “Reply-To: myplace2@example.com\r\n”; $headers .= “Return-Path: myplace@example.com\r\n”; $headers .= “CC: sombodyelse@example.com\r\n”; $headers .= “BCC: hidden@example.com\r\n”; if ( mail($to,$subject,$message,$headers) ) { echo “The email has been sent!”; } else { echo “The email has failed!”; } ?>

Getting error while sending email through Gmail SMTP – “Please log in via your web browser and then try again. 534-5.7.14” [closed]

I know this is an older issue, but I recently had the same problem and was having issues resolving it, despite attempting the DisplayUnlockCaptcha fix. This is how I got it alive. Head over to Account Security Settings (https://www.google.com/settings/security/lesssecureapps) and enable “Access for less secure apps”, this allows you to use the google smtp for … Read more

Send File Attachment from Form Using phpMailer and PHP

Try: if (isset($_FILES[‘uploaded_file’]) && $_FILES[‘uploaded_file’][‘error’] == UPLOAD_ERR_OK) { $mail->AddAttachment($_FILES[‘uploaded_file’][‘tmp_name’], $_FILES[‘uploaded_file’][‘name’]); } Basic example can also be found here. The function definition for AddAttachment is: public function AddAttachment($path, $name=””, $encoding = ‘base64’, $type=”application/octet-stream”)

Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?

$mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure=”ssl”; // secure transfer enabled REQUIRED for Gmail $mail->Host = “smtp.gmail.com”; $mail->Port = 465; // or 587 $mail->IsHTML(true); $mail->Username = “email@gmail.com”; $mail->Password … Read more

Mailer function error

You need to set SMTP host and also the port I guess which is 465: $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = “smtp.gmail.com”; $mail->SMTPAuth = true; $mail->Username = “info@gmail.com”; $mail->Password = “cc”; $mail->From = “gmail.com”.” <info@gmail.com>”; $mail->AddReplyTo(“cc1@gmail.com”); $mail->FromName = “info@gmail.com”; $mail->AddAddress($climail); $mail->AddCC(“cc1@gmail.com”); $mail->Sender=”info@gmail.com”; $mail->IsHTML(true); $mail->WordWrap = 70; $mail->Subject = $sub; echo $meegate; $mail->Body=$meegate; $mail->SMTPDebug = … Read more