Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- require_once "class.phpmailer.php";
- $mailAddress=$_POST["mailAddress"];
- $filepath='';
- if(isset($_FILES['file']))
- {
- $filepath = 'files/'.date('jS F Y h i s A').'.png';
- move_uploaded_file($_FILES['file']['tmp_name'], $filepath);
- }
- $mail = new PHPMailer();
- $mail->isSMTP();
- $mail->SMTPDebug = 2;
- $mail->Host = 'tls://smtp.gmail.com:587';
- //$mail->Port = 587;
- //$mail->SMTPSecure = 'tls';
- $mail->SMTPAuth = true;
- $mail->Username = "buenofotobudka@gmail.com";
- $mail->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- //Password to use for SMTP authentication
- $mail->Password = "fotobudka123";
- //Set who the message is to be sent from
- $mail->setFrom('buenofotobudka@gmail.com', 'Bueno Fotobudka');
- //Set an alternative reply-to address
- $mail->addReplyTo('buenofotobudka@gmail.com', 'Bueno Fotobudka');
- //Set who the message is to be sent to
- $mail->addAddress($mailAddress, '');
- //Set the subject line
- $mail->Subject = 'Bueno Fotobudka';
- //Read an HTML message body from an external file, convert referenced images to embedded,
- //convert HTML into a basic plain-text alternative body
- $mail->Body = 'Zdjecie';
- //Replace the plain text body with one created manually
- //Attach an image file
- $mail->addAttachment($filepath, 'new_file.png');
- //send the message, check for errors
- if (!$mail->send()) {
- echo "error";
- } else {
- echo "ok";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement