123 - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of 123.php
- <?php
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\SMTP;
- use PHPMailer\PHPMailer\Exception;
- //Load Composer's autoloader
- require 'vendor/autoload.php';
- ?><!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>yahoo_Mailer</title>
- <link ref="stylesheet" type="text/css" href="style.css">
- </head>
- <body>
- <div class="container">
- <?php
- if(isset($_POST['submit_form']))
- {
- echo $to=$_POST['to'];
- $subject=$_POST['subject'];
- $msg=$_POST['msg'];
- $name=$_POST['name'];
- $mail = new PHPMailer(true);
- try {
- //Server settings
- $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
- $mail->isSMTP(); //Send using SMTP
- $mail->Host = 'cpl27.main-hosting.eu'; //Set the SMTP server to send through
- $mail->SMTPAuth = true; //Enable SMTP authentication
- $mail->Password = '}{Xp[bb8@cKf'; //SMTP password
- $mail->SMTPSecure = 'tls'; //Enable implicit TLS encryption
- $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
- //Recipients
- $mail->addAddress($to,$name); //Add a recipient
- //Name is optional
- //$mail->addCC('[email protected]');
- //$mail->addBCC('[email protected]');
- //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 = $subject;
- $mail->Body = $msg;
- //$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}";
- }
- }
- ?>
- <h2>Email Sending for Yahoo</h2>
- <form action="" method="POST">
- <label> To Email :- </label>
- <input type="text" name="to" class="form-control" required>
- <label> From Name :- </label>
- <input type="text" name="Name" class="form-control" required>
- <label> Subject Line :- </label>
- <input type="Subject" name="Subject" class="form-control" required>
- <label>Html Body :- </label>
- <textarea name="msg" cols="10" rows="5"type="text" name="Name" class="form-control" required>
- </textarea><br /><br />
- <input type="submit" name="submit_form" value="send">
- </form>
- </body>
- <html>