Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mail->isSMTP(true); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'romansheep.business@gmail.com'; // SMTP username
- $mail->Password = $password; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- $mail->setFrom($email, $name);
- $mail->addAddress('romakcz@gmail.com', 'Joe User'); // Add a recipient // Name is optional
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = $subject;
- $mail->Body = $message;
- $mail->AltBody = $message;
- if($mail->send()) {
- $send_email = 'Your email was succesfully send!';
- $err = $mail->ErrorInfo;
- echo $err;
- }
- else {
- $send_email = 'There was an error with sending the email. Please try again later!';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement