home
clear breadcrumbs
search
login
 
phpmailer
Mail using PHPmailer from github. Using Composer to create env: composer require phpmailer/phpmailer SMTPDebug = 0; // set to 1 for debug $mail->isSMTP(); $mail->SMTPAuth = TRUE; $mail->SMTPSecure = "tls"; $mail->Port = 587; $mail->Host = "smtp.gmail.com"; $mail->Username = 'peteolson3150'; //SMTP username $mail->Password = ''; //Google app php-phpmailer (located in lastpass) //Recipients $mail->setFrom('peteolson3150@gmail.com', 'Pete Olson'); $mail->addAddress('pete@peteolson.me', 'Pete'); //Add a recipient //$mail->addAddress('ellen@example.com'); //Name is optional //$mail->addReplyTo('info@example.com', 'Information'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body
in bold!
'; //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; }