Skip to content

Instantly share code, notes, and snippets.

@webbyfox
Created November 15, 2012 20:43
Show Gist options
  • Save webbyfox/4081126 to your computer and use it in GitHub Desktop.
Save webbyfox/4081126 to your computer and use it in GitHub Desktop.
Amazon Product reviews.
<?php
error_reporting(E_ERROR);
require_once "Mail.php";
$lines = file('Emails.txt');
echo "sending emails...<br><br>";
foreach ($lines as $line_num => $line) {
//echo $line;
$line_array = explode(" ", $line);
//echo $line_array[0];
echo 'Sending email to '. $line_array[4]. '---';
$order_id = $line_array[0];
$buyer_name = $line_array[4];
$buyer_email = $line_array[1];
$product_title= $line_array[3];
$asin= $line_array[5];
$mail = NULL;
$url = "www.amazon.co.uk/review/create-review/ref=cm_cr_dp_wrt_top?ie=UTF8&channel=rw-dp&asin=".$asin ;
$to = $buyer_email;
$subject = "Customer review request from Micropix";
$message = <<<EOT
<html>
<head>
<title>Amazon Product Review</title>
</head>
<body style="font-family:Georgia,Serif; font-size:13px;">
<p>Dear $buyer_name, <br/><br/>
<b>Amazon Order ID</b>: $order_id <br/><br/>
<b>Product Name</b>: $product_title<br/><br/>
Thank you for your recent purchase from Micropix through Amazon. It been couple of weeks since you have placed your order with us and we were hoping you would let us, and everyone else, know what you think of our products. Your opinion is important to us.<br/><br/>
We invite you to submit a “<b>Product Review</b>” for the item you have purchased that would benefit other customers to choose the best products on Amazon. <br/><br/>
The following steps are Easy Guides to write a Customer Review. . <br/><br/>
• If you would like to review your product, click on the <b>Write a Review </b> button or follow the link below.<br><br>
<div style="align:center;" >
<a href=$url >
<img src="http://oi48.tinypic.com/2hxnfic.jpg" alt=$url/>
</a>
</div> <br/><br/>
Link: www.amazon.co.uk/review/create-review/ref=cm_cr_dp_wrt_top?ie=UTF8&channel=rw-dp&asin=$asin
<br/><br/>
• Log into your Amazon.co.uk account if prompted. <br/>
• In the "Share your opinion" section, click the radio button for the type of review you wish to submit. <br>
• Preview and complete your review. <br>
<br>
In the <b>Share your opinion</b> section, click the radio button for the type of review you wish to submit.
Preview and complete your review. <br/><br/>
If you have any problems with your order, please email us by providing your Amazon Order ID: [orderid] and we will be happy to help. <br/><br/>
Your Sincerely <br/><br/>
Zara Raynal <br/>
Customer Service Manager <br/>
Micropix <br/>
<br/> <br/></p>
</body>
</html>
EOT;
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "[email protected]";
$password = "g4dg3t321";
$headers = array("MIME-Version"=> '1.0',
"Content-type" => "text/html; charset=iso-8859-1",
"From" => '<[email protected]>',
"To" => $email,
"Subject" => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail= $smtp->send($to, $headers, $message);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("Message successfully sent! <br><br>");
}
}
echo " <b>All emails have been sent</b>"
?> <!-- end of php tag-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment