mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-21 20:16:03 +03:00
Update mime message docs for new Swiftmailer version and lib parameter update (#585)
This commit is contained in:
parent
abf2a0ae55
commit
2162ade61a
18
doc/index.md
18
doc/index.md
@ -3,8 +3,8 @@
|
|||||||
This page will document the API classes and ways to properly use the API. These resources will eventually move to
|
This page will document the API classes and ways to properly use the API. These resources will eventually move to
|
||||||
the official documentation at [https://documentation.mailgun.com](https://documentation.mailgun.com/api_reference.html).
|
the official documentation at [https://documentation.mailgun.com](https://documentation.mailgun.com/api_reference.html).
|
||||||
|
|
||||||
Other relevant documentation pages might be:
|
Other relevant documentation pages might be:
|
||||||
|
|
||||||
* [Attachments](attachments.md)
|
* [Attachments](attachments.md)
|
||||||
* [Pagination](pagination.md)
|
* [Pagination](pagination.md)
|
||||||
* [Message Builder](/src/Message/README.md)
|
* [Message Builder](/src/Message/README.md)
|
||||||
@ -90,9 +90,9 @@ $mailgun->events()->get('example.com');
|
|||||||
#### Send a message
|
#### Send a message
|
||||||
```php
|
```php
|
||||||
$parameters = [
|
$parameters = [
|
||||||
'from' => 'bob@example.com',
|
'from' => 'bob@example.com',
|
||||||
'to' => 'sally@example.com',
|
'to' => 'sally@example.com',
|
||||||
'subject' => 'The PHP SDK is awesome!',
|
'subject' => 'The PHP SDK is awesome!',
|
||||||
'text' => 'It is so simple to send a message.'
|
'text' => 'It is so simple to send a message.'
|
||||||
];
|
];
|
||||||
$mailgun->messages()->send('example.com', $parameters);
|
$mailgun->messages()->send('example.com', $parameters);
|
||||||
@ -102,10 +102,10 @@ $mailgun->messages()->send('example.com', $parameters);
|
|||||||
Below in an example how to create a Mime message with SwiftMailer.
|
Below in an example how to create a Mime message with SwiftMailer.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$message = \Swift_Message::newInstance('Mail Subject');
|
$message = new Swift_Message('Mail Subject');
|
||||||
$message->setFrom(['from@exemple.com' => 'Example Inc']);
|
$message->setFrom(['from@exemple.com' => 'Example Inc']);
|
||||||
$message->setTo(['user0gmail.com' => 'User 0', 'user1@hotmail.com' => 'User 1']);
|
$message->setTo(['user0gmail.com' => 'User 0', 'user1@hotmail.com' => 'User 1']);
|
||||||
// $message->setBcc('admin@example.com'); Do not do this, BCC will be visible for all receipients if you do.
|
// $message->setBcc('admin@example.com'); Do not do this, BCC will be visible for all receipients if you do.
|
||||||
$message->setCc('invoice@example.com');
|
$message->setCc('invoice@example.com');
|
||||||
|
|
||||||
$messageBody = 'Look at the <b>fancy</b> HTML body.';
|
$messageBody = 'Look at the <b>fancy</b> HTML body.';
|
||||||
@ -115,7 +115,7 @@ $message->setBody($messageBody, 'text/html');
|
|||||||
$to = ['admin@example.com', 'user0gmail.com', 'user1@hotmail.com', 'invoice@example.com']
|
$to = ['admin@example.com', 'user0gmail.com', 'user1@hotmail.com', 'invoice@example.com']
|
||||||
|
|
||||||
// Send the message
|
// Send the message
|
||||||
$mailgun->messages()->sendMime('example.com', $to, $message->toString());
|
$mailgun->messages()->sendMime('example.com', $to, $message->toString(), []);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Show a stored message
|
#### Show a stored message
|
||||||
@ -302,7 +302,7 @@ $valid = $mailgun->webhooks()->verifyWebhookSignature($timestamp, $token, $signa
|
|||||||
|
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
// Create a 403 response
|
// Create a 403 response
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user