HTMLThis 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); print_r($result); // require_once(APPPATH.'sendgrid-php/sendgrid-php.php'); // include APPPATH . 'sendgrid-php/sendgrid-php.php'; // $email = new \SendGrid\Mail\Mail(); /* $email->setFrom("setfrom@test.com", "testname"); $email->setSubject("MailTest"); $email->addTo('tomail@gmail.com', "User"); $email->addContent("text/plain", "subject"); $email->addContent( "text/html",'Message'); $sendgrid = new \SendGrid(('sendgrid-API-KEY_HERE')); try { $response = $sendgrid->send($email); print $response->statusCode() . "\n"; print_r($response->headers()); print $response->body() . "\n"; } catch (Exception $e) { echo 'Caught exception: '. $e->getMessage() ."\n"; } /* $CI->load->library('email'); /* $config['protocol'] = 'smtp'; //$config['smtp_host'] = 'smtp.mailtrap.io'; $config['smtp_host'] = 'smtp.sendgrid.net'; $config['smtp_port'] = '587'; $config['smtp_timeout'] = '30'; // $config['smtp_user'] = '505a0d93534180'; // $config['smtp_pass'] = '07433d0ae4879d'; $config['smtp_user'] = 'apikey'; $config['smtp_pass'] = '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'; $config['charset'] = 'utf-8'; $config['newline'] = "\r\n"; $config['mailtype'] = 'html'; // or html $config['validation'] = TRUE; // bool whether to validate email or not $CI->email->initialize(array( 'protocol' => 'smtp', 'smtp_host' => 'smtp-relay.sendinblue.com', 'smtp_user' => 'ujjwal@sentientgeeks.com', 'smtp_pass' => '4zT95dpUAYCNLnEO', 'smtp_port' => 587, 'crlf' => "\r\n", 'newline' => "\r\n" )); //$CI->email->initialize($config); //$CI->load->library('email'); $CI->email->from($from['email'],$from['name']); $CI->email->to($to); $CI->email->subject($subject); $CI->email->message($message); $CI->email->send(); echo $CI->email->print_debugger(); */ } ?>