Skip to content

Commit

Permalink
Merge branch 'prerelease' of github.com:cjbuchmann/sendgrid-php into …
Browse files Browse the repository at this point in the history
…prerelease
  • Loading branch information
CJ Buchmann committed Feb 14, 2012
2 parents 4edeb89 + d294367 commit 27e7df3
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions README.md
Expand Up @@ -64,3 +64,63 @@ Or
```php
$sendgrid->web->send($mail);
```

### Using Categories ###

Categories are used to group email statistics provided by SendGrid

To use a category, simply set the category name

```php
$mail = new SendGrid\Mail();
$mail->addTo('foo@bar.com')->
...
addCategory("Category 1")->
addCategory("Category 2");
```


### Using Attachments ###

Attachments are currently file based only, with future plans for an in memory implementation as well.

File attachments are limited to 7 MB per file.

```php
$mail = new SendGrid\Mail();
$mail->addTo('foo@bar.com')->
...
addAttachment("../path/to/file.txt");
```

### Using Substitutions ###

Substitutions can be used to customize multi-recipient emails, and tailor them for the user

```php
$mail = new SendGrid\Mail();
$mail->addTo('john@somewhere.com')->
addTo("harry@somewhere.com")->
addTo("Bob@somewhere.com")->
...
setHtml("Hey %name%, we've seen that you've been gone for a while")->
addSubstitution("%name%", array("John", "Harry", "Bob"));
```

### Using Sections ###

Sections can be used to further customize messages for the end users.

```php
$mail = new SendGrid\Mail();
$mail->addTo('john@somewhere.com')->
addTo("harry@somewhere.com")->
addTo("Bob@somewhere.com")->
...
setHtml("Hey %name%, you work at %place%")->
addSubstitution("%name%", array("John", "Harry", "Bob"))->
addSubstitution("%place%", array("%office%", "%office%", "%home%"))->
addSection("%office%", array("Mile Square Park", "Platform 4 3/4"))->
addSection("%home%", array("The Robinsons"));
```

0 comments on commit 27e7df3

Please sign in to comment.