Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Load PHP Mailer programme
- require __DIR__ . '\libraries\PHPMailerAutoload.php';
- $mail = new PHPMailer();
- try{
- mail('thefalation@gmail.com', 'hpo', 'gdb');
- // Send mail using gmail; prepare settings for the mail server
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = "smtp.mailtrap.io"; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = "a523f0e813eb20"; // GMAIL username
- $mail->Password = "ba0b14969966e0"; // GMAIL password
- $mail->SMTPSecure = "ssl"; // Enable SSL encryption, `tls` also accepted
- $mail->Port = 465; // set the SMTP port for the GMAIL server; was 465 / 587
- // Can be found e.g. in your Outlook account settings
- // Prepare email message
- $senderNaam = "Webmaster Webshop";
- $mail->addAddress($email, $naam); // Add a recipient
- $mail->setFrom($senderMail, $senderNaam); // Set sender data
- // Alternatively:
- // $mail->From = 'thefalation@gmail.com;
- // $mail->FromName = 'Sender’s Name';
- $mail->addReplyTo('thefalation@gmail.com', 'WebshopWorld');
- // $mail->addCC('cc@example.com');
- // $mail->addBCC('bcc@example.com');
- $bodyContent = '<h2>Deze email wordt gestuurd in HTML m.b.v. PHP in Localhost door De Webshop</h2>';
- $bodyContent.= '<p>Geachte ' . $naam . ', Hierbij bevestigen wij uw aanmelding. </p><p>U heeft een account bij De Webshop.</p>';
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = "Uw aanmelding bij Webshop";
- $mail->Body = $bodyContent;
- }
- catch(PDOException $e) {
- echo ("<script>alert('Account NIET aangemaakt.');location.href='index.php?page=inloggen';</script>");
- }
- // Add attachments
- // $mail->addAttachment('/var/tmp/file.tar.gz');
- // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
- // Send email
- try {
- $mail->send();
- echo "<script>alert('Er is een bevestiging verzonden naar uw e-mail'); location.href='index.php?page=inloggen';</script>";
- }
- catch(Exception $e) {
- echo "<script>alert('Fail - ' + $mail->ErrorInfo);</script>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement