Source Code For Send Email With Attachment in PHP
with the help of building career page






HTML Form

< ?php include_once('mail.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TrickuWeb</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="styles/website.css"> </head> <body> <div class="container mt-5 mycareer"> <div class="row"> <div class="col-md-8" style="margin:0 auto; float:none;"> <h3 align="center">Build Your Career With TrickuWeb</h3> <br /> <h4 align="center">Please fill this form</h4><br /> <form method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Enter Name</label> <input type="text" name="name" placeholder="Enter Name" class="form-control" required /> </div> <div class="form-group"> <label>Enter Address</label> <textarea name="address" placeholder="Enter Address" class="form-control" required></textarea> </div> <div class="form-group"> <label>Enter Email Address</label> <input type="email" name="email" class="form-control" placeholder="Enter Email Address" required /> </div> <div class="form-group"> <label>Select Your Skills</label> <select name="skills[]" class="form-control" multiple style="height:150px;" required> <option value="Flutter">Flutter</option> <option value="Laravel">Laravel</option> <option value="Django">Django</option> <option value="Firebase">Firebase</option> <option value="Android">Android</option> <option value="Data Engineer">Data Engineer</option> <option value="AI & Data Science">AI & Data Science</option> <option value="Arduino & Raspberry Pi">Arduino & Raspberry Pi</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Select Year of Experience</label> <select name="experience" class="form-control" required> <option value="">Select Experience</option> <option value="0-1 years">0-1 years</option> <option value="2-3 years">2-3 years</option> <option value="4-5 years">4-5 years</option> <option value="6-7 years">6-7 years</option> <option value="8-9 years">8-9 years</option> <option value="10 or more years">10 or more years</option> </select> </div> <div class="form-group"> <label>Enter Mobile Number</label> <input type="text" name="mobile" placeholder="Enter Mobile Number" class="form-control" pattern="\d*" required /> </div> <div class="form-group"> <label>Select Your Resume</label> <input type="file" name="resume" accept=".doc,.docx,.pdf"/ required> </div> <div class="form-group"> <label>Enter Additional Information</label> <textarea name="additional_information" placeholder="Enter Additional Information" class="form-control" required rows="8"></textarea> </div> </div> </div> <div class="form-group" align="center"> <input type="submit" name="submit" value="Submit" class="btn btn-lg btn-success" /> </div> </form> </div> </div> </div> </body> </html>


mail.php File

< ?php $message = ''; if (isset($_POST["submit"])) { $skills = ''; foreach ($_POST["skills"] as $row) { $skills .= $row . ', '; } $skills = substr($skills, 0, -2); $path = 'upload/' . $_FILES["resume"]["name"]; move_uploaded_file($_FILES["resume"]["tmp_name"], $path); $message = ' <h3 align="center">Applicant Details</h3> <table border="1" width="100%" cellpadding="5" cellspacing="5"> <tr> <td width="30%">Name</td> <td width="70%">' . $_POST["name"] . '</td> </tr> <tr> <td width="30%">Address</td> <td width="70%">' . $_POST["address"] . '</td> </tr> <tr> <td width="30%">Email Address</td> <td width="70%">' . $_POST["email"] . '</td> </tr> <tr> <td width="30%">Area of Interest</td> <td width="70%">' . $skills . '</td> </tr> <tr> <td width="30%">Experience Year</td> <td width="70%">' . $_POST["experience"] . '</td> </tr> <tr> <td width="30%">Phone Number</td> <td width="70%">' . $_POST["mobile"] . '</td> </tr> <tr> <td width="30%">Additional Information</td> <td width="70%">' . $_POST["additional_information"] . '</td> </tr> </table> '; require 'class/class.phpmailer.php'; $mail = new PHPMailer; $mail->IsSMTP(); //Sets Mailer to send message using SMTP // ADD YOUR DETAILS HERE $mail->Host = 'smtp.gmail.com'; //Sets the SMTP hosts of your Email hosting, this for Godaddy $mail->Port = '465'; //Sets the default SMTP server port $mail->SMTPAuth = true; //Sets SMTP authentication. Utilizes the Username and Password variables $mail->Username = 'yourEmail@gmail.com'; //Sets SMTP username $mail->Password = 'YourPassword'; //Sets SMTP password $mail->SMTPSecure = 'ssl'; //Sets connection prefix. Options are "", "ssl" or "tls" $mail->From = 'designinnovationpatna@gmail.com'; //Sets the From email address for the message $mail->FromName = 'Trickuweb.Com - Coding Master'; //Sets the From name of the message $mail->AddAddress('praveen@trickuweb', 'Praveen Kumar'); //Adds a "To" address // ADD YOUR DETAILS HERE $mail->WordWrap = 50; //Sets word wrapping on the body of the message to a given number of characters $mail->IsHTML(true); //Sets message type to HTML $mail->AddAttachment($path); //Adds an attachment from a path on the filesystem $mail->Subject = 'Application for JOB'; //Sets the Subject of the message $mail->Body = $message; //An HTML or plain text message body if ($mail->Send()) //Send an Email. Return true on success or false on error { $message = '<div class="alert alert-success">Application Successfully Submitted</div>'; unlink($path); } else { $message = '<div class="alert alert-danger">There is an Error</div>'; } }


GET CONNECTED TO WORK ON YOUR IDEA

CONNECT NOW
Call Trickuweb