forked from phiali/mail_transport_postmark
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
30 lines (22 loc) · 1.58 KB
/
README
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
Postmarkapp is a "email delivery in the cloud" service for sending out transactional emails in your applications. By using this service you don't need to worry about the setup and maintenance of a mailserver and as Postmarkapp is built to scale it can easily deal with large bursts of messages. Whilst an easy-to-use API is available this Zend_Mail transport allows you to easily switch out and use Postmark for mail delivery.
Usage is as simple as:
<?php
Zend_Mail::setDefaultTransport( new Mail_Transport_Postmark( 'your_api_key' ) );
$mail = new Zend_Mail();
$mail->setFrom( 'alistair...', 'Alistair Phillips' );
$mail->setReplyTo( 'some-other-address', 'Alistair Phillips' );
$mail->addTo( 'new-user-address', 'Joe Smith' );
$mail->setSubject( 'Welcome to...' );
$mail->setBodyText( 'This is an example of a text body' );
$mail->setBodyHtml( 'This is an example of an HTML body with <strong>bold</strong>' );
$mail->send();
?>
One call to setDefaultTransport() and you're now using the cloud for delivery. Added support for attachments to the class.
Alternatively, you can use our application resource.
In your application/config/application.ini, add these lines:
; This makes sure that your Zend Framework application can find the correct
; resource file. Make sure, the Postmark folder is within your library folder.
pluginPaths.Postmark_Application_Resource = "Postmark/Application/Resource"
; This initializes the Postmark drop-in replacement.
resources.postmark.apikey = "your_api_key"
Now you're good to go and don't have to manually do anything else.