Test'; // $ch = curl_init(); // $senddata = '{ // "Messages":[ // { // "From": { // "Email": "ujjwal@sentientgeeks.com", // "Name": "Ujjwal" // }, // "To": [ // { // "Email":"'.$to.'" // } // ], // "Subject": "'.$subject.'", // "HTMLPart": "'.$message.'" // } // ] // }'; // //echo $senddata;die; // $username='bad29f69421a73e83da553fafda450a2'; // $password='8ace947e7398c99ec88b2f9646e1a057'; // $headers = array( // 'Content-Type:application/json' // //'Authorization: Basic YmFkMjlmNjk0MjFhNzNlODNkYTU1M2ZhZmRhNDUwYTI6OGFjZTk0N2U3Mzk4Yzk5ZWM4OGIyZjk2NDZlMWEwNTc=' // ); // curl_setopt($ch, CURLOPT_URL, "https://api.mailjet.com/v3.1/send"); // curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_POSTFIELDS,$senddata); // //curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"cc\":[\"cc@example.net\":\"cc whom!\"],\"text\":\"This is the text\",\"bcc\":[\"ujjwal@sentientgeeks.com\":\"bcc whom!\"],\"replyto\":[\"ujjwal@sentientgeeks.com\",\"reply to!\"],\"html\":\"This is the

HTML

This is inline image 1.
\"image1\"
Some text
This is inline image 2.
\"image2\"
Some more text
Re-used inline image 1.
\"image3\"\",\"to\":{\"ujjwal@sentientgeeks.com\":\"to whom!\"},\"attachment\": {\"myfilename.pdf\":\"your_pdf_files_base64_encoded_chunk_data\"},\"from\":[\"ujjwal@sentientgeeks.com\",\"from email!\"],\"subject\":\"My subject\",\"headers\":{\"Content-Type\":\"text/html; charset=iso-8859-1\", \"X-param1\":\"value1\",\"X-param2\":\"value2\", \"X-Mailin-custom\":\"my custom value\",\"X-Mailin-IP\":\"102.102.1.2\", \"X-Mailin-Tag\":\"My tag\"},\"inline_image\":{\"myinlineimage1.png\":\"your_png_files_base64_encoded_chunk_data\", \"myinlineimage2.jpg\":\"your_jpg_files_base64_encoded_chunk_data\"}}"); // curl_setopt($ch, CURLOPT_POST, 1); // //$headers = array(); // //$headers[] = "user: bad29f69421a73e83da553fafda450a2:8ace947e7398c99ec88b2f9646e1a057"; // //$headers[] = "Content-Type: application/json"; // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // $result = curl_exec($ch); // if (curl_errno($ch)) { // echo 'Error:' . curl_error($ch); // } // curl_close ($ch); // return $result; // } function send_email($from,$to,$subject,$message){ $CI = &get_instance(); //echo APPPATH; //$messages='

Test

'; $ch = curl_init(); $personalizationsData= '{ "personalizations":[ { "to":[ { "email":"'.$to.'" } ], "subject": "'.$subject.'" } ], "content": [{"type": "text/html", "value": "'.$message.'"}], "from":{"email": "'.EMAIL_FROM.'","name": "'._SITE_TITLE_.'"}, "reply_to":{"email": "'.EMAIL_FROM.'","name": "'._SITE_TITLE_.'"} }'; $header = array( 'Content-Type:application/json', 'Authorization: Bearer '.SEND_GRID_API_KEY.'' ); curl_setopt($ch, CURLOPT_URL, SEND_GRID_URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$personalizationsData); //curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"cc\":[\"cc@example.net\":\"cc whom!\"],\"text\":\"This is the text\",\"bcc\":[\"ujjwal@sentientgeeks.com\":\"bcc whom!\"],\"replyto\":[\"ujjwal@sentientgeeks.com\",\"reply to!\"],\"html\":\"This is the

HTML

This is inline image 1.
\"image1\"
Some text
This is inline image 2.
\"image2\"
Some more text
Re-used inline image 1.
\"image3\"\",\"to\":{\"ujjwal@sentientgeeks.com\":\"to whom!\"},\"attachment\": {\"myfilename.pdf\":\"your_pdf_files_base64_encoded_chunk_data\"},\"from\":[\"ujjwal@sentientgeeks.com\",\"from email!\"],\"subject\":\"My subject\",\"headers\":{\"Content-Type\":\"text/html; charset=iso-8859-1\", \"X-param1\":\"value1\",\"X-param2\":\"value2\", \"X-Mailin-custom\":\"my custom value\",\"X-Mailin-IP\":\"102.102.1.2\", \"X-Mailin-Tag\":\"My tag\"},\"inline_image\":{\"myinlineimage1.png\":\"your_png_files_base64_encoded_chunk_data\", \"myinlineimage2.jpg\":\"your_jpg_files_base64_encoded_chunk_data\"}}"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); return $result; } // attachment function send_email_attach($from,$to,$subject,$message,$attach){ $CI = &get_instance(); //echo APPPATH; //$messages='

Test

'; $ch = curl_init(); $personalizationsData= '{ "personalizations":[ { "to":[ { "email":"'.$to.'" } ], "subject": "'.$subject.'" } ], "content": [{"type": "text/html", "value": "'.$message.'"}], "from":{"email": "'.EMAIL_FROM.'","name": "'._SITE_TITLE_.'"}, "reply_to":{"email": "'.EMAIL_FROM.'","name": "'._SITE_TITLE_.'"}, "attachment":{"content": "attachment", "filename": "'.$attach.'", "type": "application/pdf", "disposition": "attachment"} }'; $header = array( 'Content-Type:application/json', 'Authorization: Bearer '.SEND_GRID_API_KEY.'' ); curl_setopt($ch, CURLOPT_URL, SEND_GRID_URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$personalizationsData); //curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"cc\":[\"cc@example.net\":\"cc whom!\"],\"text\":\"This is the text\",\"bcc\":[\"ujjwal@sentientgeeks.com\":\"bcc whom!\"],\"replyto\":[\"ujjwal@sentientgeeks.com\",\"reply to!\"],\"html\":\"This is the

HTML

This is inline image 1.
\"image1\"
Some text
This is inline image 2.
\"image2\"
Some more text
Re-used inline image 1.
\"image3\"\",\"to\":{\"ujjwal@sentientgeeks.com\":\"to whom!\"},\"attachment\": {\"myfilename.pdf\":\"your_pdf_files_base64_encoded_chunk_data\"},\"from\":[\"ujjwal@sentientgeeks.com\",\"from email!\"],\"subject\":\"My subject\",\"headers\":{\"Content-Type\":\"text/html; charset=iso-8859-1\", \"X-param1\":\"value1\",\"X-param2\":\"value2\", \"X-Mailin-custom\":\"my custom value\",\"X-Mailin-IP\":\"102.102.1.2\", \"X-Mailin-Tag\":\"My tag\"},\"inline_image\":{\"myinlineimage1.png\":\"your_png_files_base64_encoded_chunk_data\", \"myinlineimage2.jpg\":\"your_jpg_files_base64_encoded_chunk_data\"}}"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); return $result; } function cgq_email($to,$subject,$token) { $msg= "
"; $message = $msg; // echo $message; // die(); $CI = &get_instance(); $ch = curl_init(); // $senddata = '{ // "Messages":[ // { // "From": { // "Email": "ujjwal@sentientgeeks.com", // "Name": "WeCuro Onboarding Process" // }, // "To": [ // { // "Email":"'.$to.'" // } // ], // "Subject": "'.$subject.'", // "HTMLPart": "'.$message.'" // } // ] // }'; // $username='bad29f69421a73e83da553fafda450a2'; // $password='8ace947e7398c99ec88b2f9646e1a057'; // $headers = array( // 'Content-Type:application/json' // //'Authorization: Basic YmFkMjlmNjk0MjFhNzNlODNkYTU1M2ZhZmRhNDUwYTI6OGFjZTk0N2U3Mzk4Yzk5ZWM4OGIyZjk2NDZlMWEwNTc=' // ); // curl_setopt($ch, CURLOPT_URL, "https://api.mailjet.com/v3.1/send"); // curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_POSTFIELDS,$senddata); // curl_setopt($ch, CURLOPT_POST, 1); // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // $result = curl_exec($ch); // if (curl_errno($ch)) { // echo 'Error:' . curl_error($ch); // } $personalizationsData= '{ "personalizations":[ { "to":[ { "email":"'.$to.'" } ], "subject": "'.$subject.'" } ], "content": [{"type": "text/html", "value": "'.$message.'"}], "from":{"email":"moli@sentientgeeks.com","name":"WeCuro"}, "reply_to":{"email":"moli@sentientgeeks.com","name":"WeCuro"} }'; $header = array( 'Content-Type:application/json', 'Authorization: Bearer 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' ); curl_setopt($ch, CURLOPT_URL, "https://api.sendgrid.com/v3/mail/send"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$personalizationsData); //curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"cc\":[\"cc@example.net\":\"cc whom!\"],\"text\":\"This is the text\",\"bcc\":[\"ujjwal@sentientgeeks.com\":\"bcc whom!\"],\"replyto\":[\"ujjwal@sentientgeeks.com\",\"reply to!\"],\"html\":\"This is the

HTML

This is inline image 1.
\"image1\"
Some text
This is inline image 2.
\"image2\"
Some more text
Re-used inline image 1.
\"image3\"\",\"to\":{\"ujjwal@sentientgeeks.com\":\"to whom!\"},\"attachment\": {\"myfilename.pdf\":\"your_pdf_files_base64_encoded_chunk_data\"},\"from\":[\"ujjwal@sentientgeeks.com\",\"from email!\"],\"subject\":\"My subject\",\"headers\":{\"Content-Type\":\"text/html; charset=iso-8859-1\", \"X-param1\":\"value1\",\"X-param2\":\"value2\", \"X-Mailin-custom\":\"my custom value\",\"X-Mailin-IP\":\"102.102.1.2\", \"X-Mailin-Tag\":\"My tag\"},\"inline_image\":{\"myinlineimage1.png\":\"your_png_files_base64_encoded_chunk_data\", \"myinlineimage2.jpg\":\"your_jpg_files_base64_encoded_chunk_data\"}}"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); print_r($result); } function cgdoc_email($to,$subject,$message) { // echo $message; // die(); $CI = &get_instance(); $ch = curl_init(); $personalizationsData= '{ "personalizations":[ { "to":[ { "email":"'.$to.'" } ], "subject": "'.$subject.'" } ], "content": [{"type": "text/html", "value": "'.$message.'"}], "from":{"email":"'.EMAIL_FROM.'","name":"'._SITE_TITLE_.'"}, "reply_to":{"email":"'.EMAIL_FROM.'","name":"'._SITE_TITLE_.'"} }'; $header = array( 'Content-Type:application/json', 'Authorization: Bearer '.SEND_GRID_API_KEY.'' ); curl_setopt($ch, CURLOPT_URL, SEND_GRID_URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$personalizationsData); //curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"cc\":[\"cc@example.net\":\"cc whom!\"],\"text\":\"This is the text\",\"bcc\":[\"ujjwal@sentientgeeks.com\":\"bcc whom!\"],\"replyto\":[\"ujjwal@sentientgeeks.com\",\"reply to!\"],\"html\":\"This is the

HTML

This is inline image 1.
\"image1\"
Some text
This is inline image 2.
\"image2\"
Some more text
Re-used inline image 1.
\"image3\"\",\"to\":{\"ujjwal@sentientgeeks.com\":\"to whom!\"},\"attachment\": {\"myfilename.pdf\":\"your_pdf_files_base64_encoded_chunk_data\"},\"from\":[\"ujjwal@sentientgeeks.com\",\"from email!\"],\"subject\":\"My subject\",\"headers\":{\"Content-Type\":\"text/html; charset=iso-8859-1\", \"X-param1\":\"value1\",\"X-param2\":\"value2\", \"X-Mailin-custom\":\"my custom value\",\"X-Mailin-IP\":\"102.102.1.2\", \"X-Mailin-Tag\":\"My tag\"},\"inline_image\":{\"myinlineimage1.png\":\"your_png_files_base64_encoded_chunk_data\", \"myinlineimage2.jpg\":\"your_jpg_files_base64_encoded_chunk_data\"}}"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); print_r($result); } ?>