Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.62 KB | None | 0 0
  1. <?php
  2. include "classes/class.phpmailer.php"; // include the class name
  3.  
  4. define("SMTP_HOST", "eko78.isimtescil.net"); //Hostname of the mail server
  5. define("SMTP_PORT", "465"); //Port of the SMTP like to be 25, 80, 465 or 587
  6. define("SMTP_UNAME", "bilgi@balikesiradamgibibiyer.com"); //Username for SMTP authentication any valid email created in your domain
  7. define("SMTP_PWORD", "0112358h"); //Password for SMTP authentication
  8. // you can get your SMTP host here http://www.asif18.com/6/php/list-of-smtp-and-pop3-severs,-hosts,-ports-email-servers/
  9.  
  10.  
  11. //Prefedined Variables  
  12. $to = "bilgi@balikesiradamgibibiyer.com";
  13.  
  14.  
  15.  
  16. // Email Subject
  17. $subject = "Contact from your website.";
  18.  
  19.  
  20. // This IF condition is for improving security  and Prevent Direct Access to the Mail Script.
  21. if($_POST) {
  22.  
  23. // Collect POST data from form
  24. $name = stripslashes($_POST['name']);
  25. $email = stripslashes($_POST['email']);
  26. $phone = stripslashes($_POST['phone']);
  27. $message= stripslashes($_POST['message']);
  28.  
  29. // Collecting all content in HTML Table
  30. $content='<table width="100%">
  31. <tr><td  align "center"><b>Contact Details</b></td></tr>
  32. <tr><td>Name:</td><td> '.$name.'</td></tr>
  33. <tr><td>Email:</td><td> '.$email.' </td></tr>
  34. <tr><td>Subject:</td><td> '.$phone.'</td></tr>
  35. <tr><td>Message:</td> <td> '.$message.'</td></tr>
  36. <tr><td>Date:</td> <td> '.date('d/m/Y').'</td></tr>
  37. </table> ';
  38.  
  39.  
  40. $mail = new PHPMailer; // call the class
  41.     $mail->IsSMTP();
  42.     $mail->IsHTML();
  43.    
  44.     $mail->Host = SMTP_HOST; //Hostname of the mail server
  45.     $mail->Port = SMTP_PORT; //Port of the SMTP like to be 25, 80, 465 or 587
  46.     $mail->SMTPAuth = true; //Whether to use SMTP authentication
  47.     $mail->Username = SMTP_UNAME; //Username for SMTP authentication any valid email created in your domain
  48.     $mail->Password = SMTP_PWORD; //Password for SMTP authentication
  49.     //$mail->AddReplyTo("reply@yourdomain.com", ""); //reply-to address
  50.     //$mail->SetFrom("from@yourdomain.com", "SMTP Mailer"); //From address of the mail
  51.     // put your while loop here like below,
  52.     $mail->Subject = $subject; //Subject od your mail
  53.     $mail->AddAddress($to, ""); //To address who will receive this email
  54.     $mail->Body    = $content; //Put your body of the message you can place html code here
  55.     //$mail->AddAttachment("images/asif18-logo.png"); //Attach a file here if any or comment this line,
  56.     $mail->SMTPDebug  = 1;
  57.     $send = $mail->Send(); //Send the mails
  58.  
  59.  
  60. // Sending Email
  61. if($send){
  62.         echo '<center><h3 style="color:#009933;">Thank you, we will getback to you shortly</h3></center>';
  63.     }
  64.     else{
  65.         echo '<center><h3 style="color:#FF3300;">Mail error: </h3></center>'.$mail->ErrorInfo;
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement