I have ready order confirm script in HTML/PHP in Asp.net project (receipt.php) ready to mail to customer, but strangely can't manage to send it with Sendgrid no matter how hard I've tried.
<?php
$_SESSION['data'] = $_POST['data'];
$data = $_SESSION['data'];
$email = $data[email];
$first_name = $data[shipping_address][name];
$address1 = $data[shipping_address][address_line_1];
$zip = $data[shipping_address][zip];
$city = $data[shipping_address][city];
$messageaddr = "
<html>
<head>
<title>
<td align='left' valign='bottom' width='350'>
<font face='Verdana, Geneva, sans-serif' size='2'></font>
</td>
<td align='left' valign='bottom' width='250'>
</td>
</tr>
</tbody></table>
<hr>
<table width='100%' cellpadding='0' cellspacing='0'>
<tbody><tr>
<td valign='top'>
<p><font face='Verdana, Geneva, sans-serif' size='4'>Laskutusosoite</font></p>
<font face='Verdana, Geneva, sans-serif' size='2'>
$first_name<br>
<br>
$address1<br>
$zip $city<br>
<br>
Suomi<br>
<a href='mailto: $email' target='_blank'>$email</a><br>
<div id=':nj' class='a3s' style='overflow: hidden;'><div class='adM'>
$namearr = $_POST["name"];
$imagearr = $_POST["image"];
$pricearr = $_POST["price"];
$quantityarr = $_POST["quantity"];
$totalcostarr = $_POST["totalcost"];
ob_start();
for ($x = 0; $x <= $lenth-1; $x++) {
echo "<td align='left' style='padding:10px 10px 10px 0;border-bottom:1px solid #d7d7d7;vertical-align:top'>
<td align='right' style='padding:10px 0;border-bottom:1px solid #d7d7d7;vertical-align:top'><p><font face='Tahoma, arial, sans-serif' size='2'>$pricearr[$x]<br></font></p></td>
<td align='right' style='padding:10px 0;border-bottom:1px solid #d7d7d7;vertical-align:top'><p><font face='Tahoma, arial, sans-serif' size='2'>$quantityarr[$x]<br></font></p></td>
<td align='right' style='padding:10px 0;border-bottom:1px solid #d7d7d7;vertical-align:top'><p><font face='Tahoma, arial, sans-serif' size='2'>$totalcostarr[$x]<br></font></p></td>
</tr><tr>
$products = ob_get_clean();
ob_end_clean();
$footermessage = "
</tr></tbody>
<tfoot>
<tr>
<td style='padding:10px 0;border-bottom:2px solid #000'> </td>
<td style='padding:10px 0;border-bottom:2px solid #000' align='right'><font face='Tahoma, arial, sans-serif' size='2'>Välisumma<br>Toimitus</font></td>
<td style='padding:10px 0;border-bottom:2px solid #000'> </td>
<td style='padding:10px 0;border-bottom:2px solid #000' align='right'><font face='Tahoma, arial, sans-serif' size='2'>$subtotal<br>$shipping</font></td>
</tr>
<tr>
style='padding:10px 0;border-bottom:1px solid #000'> </td>
</tr>
</tbody>
<tfoot>
";
$message = $messageaddr . ' ' . $products . ' ' . $footermessage;
return $message;
?>
I've tried with GitHub instructs https://github.com/sendgrid/sendgrid-php, added necessary 'requires' to composer.json-file etc., what else do I need on top these, except of course user and password?
No more lucky with instructions of Azure https://azure.microsoft.com/en-us/documentation/articles/store-sendgrid-php-how-to-send-email/ ,I have composer, but no matter is it with SMTP API or Web Api, with Swift ends for same 500 server error, can't even managed to install for Web Api with Curl.
Sendgrid wizard https://sendgrid.com/docs/Utilities/code_workshop.html provided the whole lib/vendor folders and several probable essential files, but don't know, should the whole package include my Web api project or just necessary (sendgrid-php, autoload.php etc.) and to which directory they needed to copy?
How on earth they call sendgrid easy(????) or maybe I still miss something essential? Would be grateful, if somebody could give yet another instructions for dummy , prefer with PHP-script, but with ASP.NET C# too, if that could be apply for this equally.
main.js posting the receipt;
var xhr = $.post('receipt.php', { data: data, name: name, image: image, price: price, quantity: quantity, totalcost: totalcost, totals: basketCollection.totals , length: basketCollection.length }, function (data) {
var data_from_ajax = data;
console.log(data_from_ajax);
});