Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Test</title>
- </head>
- <body>
- <?php
- require("phpmailer/_lib/class.phpmailer.php");
- $mail = new PHPMailer(true);
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'user@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('user@gmail.com', 'Mailer');
- $mail->addAddress('empfänger@gmail.com', 'Empfänger'); // Add a recipient
- $mail->addReplyTo('user@gmail.com', 'Information');
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Here is the subject';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
- try{
- $mail->send();
- echo 'Message has been sent';
- }
- catch{
- echo 'Message could not be sent.';
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement