forked from sendgrid/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp.html
More file actions
38 lines (32 loc) · 1.05 KB
/
Copy pathphp.html
File metadata and controls
38 lines (32 loc) · 1.05 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
---
layout: page
weight: 0
title: PHP
navigation:
show: true
---
<p>In this example, we want to parse all emails at <em>address</em>@email.sendgrid.biz and post the parsed email to http://sendgrid.com/email.php.</p>
<p>Given this scenario, the following are the parameters you would set at the <a href="http://sendgrid.com/developer/reply">Parse API settings page</a>:</p>
{% codeblock %}
Hostname: email.sendgrid.biz
{% endcodeblock %}
{% codeblock %}
URL: http://sendgrid.com/email.php
{% endcodeblock %}
To test this scenario, we sent an email to [email protected] and created the following form at http://sendgrid.com/email.php:
{% codeblock lang:php %}
<?php
$to = $_POST["to"];
$from = $_POST["from"];
$body = $_POST["text"];
$subject = $_POST["subject"];
$num_attachments = $_POST["attachments"];
if($num_attachments){
$uploadName = "attachment1";
for($x =0; $x<$num_attachments; $x++) {
move_uploaded_file ($_FILES[$uploadName] ['tmp_name'],"./uploads/{$_FILES[$uploadName] ['name']}");
$uploadName++;
}
}
?>
{% endcodeblock %}