-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathemail.php
More file actions
46 lines (36 loc) · 1.14 KB
/
email.php
File metadata and controls
46 lines (36 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
var_dump(function_exists('curl_version'));
$url = 'https://api.sendgrid.com/';
$user = 'azure_0632f0b7fa0883f933161d8e839dbfee@azure.com';
$pass = 'testing123';
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => 'michaeloneill94@live.ie',
'subject' => 'testing from curl',
'html' => 'testing body',
'text' => 'testing body',
'from' => 'michaeloneill94@live.ie',
);
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
echo json_encode($params);
curl_setopt ($session, CURLOPT_POSTFIELDS, json_encode($params));
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false)
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
curl_close($session);
echo $response;
// print everything out
print_r($response);
echo "here!!";
?>