Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="form" action="vendor/sendmail.php" method="post">
- <div class="field">
- <label class="label">Name</label>
- <div class="control">
- <input class="input" type="text" name="nome" placeholder="Name">
- </div>
- </div>
- <div class="field">
- <label class="label">Email</label>
- <div class="control">
- <input class="input" type="email" name="email" placeholder="Email">
- </div>
- </div>
- <div class="field">
- <label class="label">Message</label>
- <div class="control">
- <textarea class="textarea" name="mensagem" placeholder="Message"></textarea>
- </div>
- </div>
- <div class="field is-grouped">
- <div class="control">
- <button class="button is-link">Submit</button>
- </div>
- </div>
- </form>
- $nome = $_POST["nome"];
- $email = $_POST["email"];
- $mensagem = $_POST["mensagem"];
- // These must be at the top of your script, not inside a function
- use PHPMailerPHPMailerPHPMailer;
- use PHPMailerPHPMailerException;
- //Load Composer's autoloader
- require 'autoload.php';
- $mail = new PHPMailer(true); // Passing `true` enables exceptions
- try {
- //Server settings
- $mail->SMTPDebug = 2; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->Host = 'mail.eftmkg.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'info@eftmkg.com'; // SMTP username
- $mail->Password = 'xxxxxxxxxxxx'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- //Recipients
- $mail->setFrom('info@eftmkg.com', 'Mailer');
- $mail->addAddress('kaio.maia.so@gmail.com', 'Kaio Maia'); // Add a recipient
- $mail->addAddress('info@eftmkg.com'); // Name is optional
- $mail->addReplyTo('info@eftmkg.com', 'Info');
- //$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 = 'EFTMKG';
- $mail->Body = '$mensagem';
- //$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;
- }
- //Attachments
- $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
- $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
Add Comment
Please, Sign In to add comment