<?php
/**
 * This example shows making an SMTP connection with authentication.
 */

//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that


require 'mail/PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages

//Ask for HTML-friendly debug output

//Set the hostname of the mail server
$mail->Host = "smtp.mandrillapp.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "tmcards dot com";
//Password to use for SMTP authentication
$mail->Password = "isCuoXLG9ID4KgK0h5Iqjg";
//Set who the message is to be sent from
$mail->setFrom('sales@tmcards.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('sharosharmila@gmail.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('sharosharmila@gmail.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body

 $message = "<table border='1'>";
 $message .= "<tr><th>Plastic Coated Paper</th><td>".($_POST['plastic_coated_paper'] == 'Select Paper' ? 'NA' : $_POST['plastic_coated_paper']).
    "</td><th>100% Pure Plastic</th><td>".($_POST['pure_plastic'] == 'Select Plastic' ? 'NA' : $_POST['pure_plastic'])."</td></tr>";
 
 $message .= "<tr><th>Quantity (Number of decks)</th><td>".$_POST['quantity']."</td><th>Size Specifications</th><td>".$_POST['size_specifications']."</td></tr>";
 
 $message .= "<tr><th>Enter your Custom Size and Shape</th><td>".($_POST['custom_size_shape'] == '' ? 'NA' :$_POST['custom_size_shape']).
    "</td><th>Number of cards per deck</th><td>".($_POST['cards_per_deck'] == '' ? 'NA' : $_POST['cards_per_deck'])."</td></tr>";
 
 $message .= "<tr><th>Playing Card Faces</th><td>".($_POST['playing_card_faces'] == 'Select Faces' ? 'NA' : $_POST['playing_card_faces']).
    "</td><th>Feel Of The Cards</th><td>".(($_POST['feel_of_card'] != 'Non Embossed/Smooth Finished' && $_POST['feel_of_card1'] != 'Embossed/Linen Finished/Textured Cards') ? 'NA' : $_POST['feel_of_card'].$_POST['feel_of_card1'])."</td></tr>";
    
 
 /* $message .= "<tr><th>Colors to be printed on Back</th><td>".($_POST['colors_to_be_printed_on_back'] == 'Select Color' ? 'NA' : $_POST['colors_to_be_printed_on_back']).
    "</td><th>Panton Special Color Requirement</th><td>".($_POST['panton_special_color_requirement'] == '' ? 'NA' : $_POST['panton_special_color_requirement'])."</td></tr>";
  */
 $message .= "<tr><th>Wrapping</th><td>".($_POST['wrapping'] == 'Select Wrapping Options' ? 'NA' : $_POST['wrapping']).
    "</td><th>Coating Finish</th><td>".($_POST['coating_finish'] == 'Select Coating' ? 'NA' : $_POST['coating_finish'])."</td></tr>";
 
 /* $message .= "<tr><th>Gold Foil Options</th><td>".(($_POST['gold_foil_option'] != 'Gold / Silver Printing' && $_POST['gold_foil_option1'] != 'Gold Foil Stamping' ) ? 'NA' : $_POST['gold_foil_option'].'<br/>'.$_POST['gold_foil_option1']).
    "</td><th>Colors to be printed on Front</th><td>".($_POST['colors_to_be_printed_on_front'] == 'Select Color' ? 'NA' : $_POST['colors_to_be_printed_on_front'])."</td></tr>";
  
 $message .= "<tr><th>Leather Cases</th><td>".($_POST['leather_cases'] == 'Select Leather Cases' ? 'NA' : $_POST['leather_cases']).
    "</td><th>Instruction Sheet Paper</td><td>".($_POST['instruction_sheet_paper'] == 'Select Instruction Sheet Paper' ? 'NA' : $_POST['instruction_sheet_paper'])."</th></tr>";
 
 $message .= "<tr><th>Instruction Sheet Printing Options</th><td>".($_POST['instruction_sheet_printing_options'] == 'Select Printing Options' ? 'NA' : $_POST['instruction_sheet_printing_options']).
    "</td><th>No. of colors for the instruction sheet</th><td>".($_POST['no_of_colors_for_instruction_sheet'] == 'Select Instruction Sheet Color' ? 'NA' : $_POST['no_of_colors_for_instruction_sheet'])."</td></tr>";
 */
 $message .= "<tr><th>Packaging</th><td>".($_POST['packaging'] == 'Select Packaging' ? 'NA' : $_POST['packaging']).
    "</td><th>Delivery Time</th><td>".($_POST['delivery_time'] == 'Select Delivery Time' ? 'NA' : $_POST['delivery_time'])."</td></tr>";
 
 $message .= "<tr><th>Display Pack Option</th><td>".($_POST['display_pack_option'] == 'Select Display Pack Option' ? 'NA' : $_POST['display_pack_option']).
    "</td><th>Mode of Delivery</th><td>".( $_POST['mode_of_delivery'] == 'Select Mode of Delivery' ? 'NA' : $_POST['mode_of_delivery'])."</td></tr>";
 
 $message .= "<tr><th>Comments</th><td colspan=3>".($_POST['details'] == '' ? 'NA' : $_POST['details'])."</td></tr>";
 
 $message .= "<tr><th>First Name</th><td>".$_POST['fname']."</td><th>Last Name</th><td>".$_POST['lname']."</td></tr>";
 $message .= "<tr><th>Email</th><td>".$_POST['email']."</td><th>Telephone Number</th><td>".$_POST['telno']."</td></tr>";
 $message .= "<tr><th>Mobile Number</th><td>".$_POST['mobileno']."</td><th>City</th><td>".$_POST['city']."</td></tr>";
 $message .= "<tr><th>Address 1</th><td>".$_POST['address1']."</td><th>Address 2</th><td>".$_POST['address2']."</td></tr>";
 $message .= "<tr><th>Zip Code</th><td>".$_POST['zipcode']."</td><th>State</th><td>".$_POST['state']."</td></tr>";
 $message .= "<tr><th>Country</th><td>".$_POST['country']."</td><th>Fax</th><td>".($_POST['fax'] == '' ? 'NA' : $_POST['fax'])."</td></tr>";
 $message .= "<table>";
//Replace the plain text body with one created manually
$mail->Body=$message;
//Attach an image file


//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
