Download the PHP package prspace/mailjet without Composer
On this page you can find all versions of the php package prspace/mailjet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mailjet
Laravel 4 Mailjet Integration
- Laravel: 4
- Author: Parvez Rahaman
- Author Homepage: https://github.com/prspace
This package extends the Laravel 4 MailService to enable Mailjet integration, based on Mailjet API v3.
Installation
Firstly you want to include this package in your composer.json file.
Now you'll want to update or install via composer.
Next you open up app/config/app.php and replace the MailServiceProvider with
NOTE It is very important that you replace the default service providers to avoid conflicts. You don't lose any original functionality regarding mail drivers, they are still available.
Configuration is pretty easy: add the following entry to your config/services.php:
And replace the values with your respective api key and secret key.
Next, change the mail driver in your config/mail.php or your .env file to 'mailjet', and make sure you have a valid and authorised from-address configured.
That's all and you're good to go. For usage, check the Laravel 4 mail documentation
API access
I have also integrated direct access to Mailtjet's API, based on their example code.
To install, append the aliases in config/app.php with
Examples
Based on https://github.com/mailjet/mailjet-apiv3-php-simple/blob/master/README.md
SendAPI
-
A function to send an email :
-
A function to send an email with some attachments (absolute paths on your computer) :
- A function to send an email with some inline attachments (absolute paths on your computer) :
Account Settings
-
A function to get your profile information :
- A function to update the field of your profile :
Contact Lists
-
A function to print the list of your contacts :
-
A function to update your contactData resource with ID , using arrays :
-
A function to create a list with name :
- A function to get a list with ID :
Note : You can use unique fields of resources instead of IDs, like in your array for this example
-
A function to create a contact with email :
-
A function to add the contact which ID is to the list which ID is :
-
A function to delete the list which ID is :
-
A function to get unsubscribed contact(s) from a list with ID :
- A function to get a contact with ID :
Note : You can use unique fields of resources instead of IDs, like in your array for this example
Newsletters
You can use the action to manage the content of a newsletter, in Text and Html. It has two properties : and . You can use , , and both requests on this action :
- : you get the and properties of a newsletter
- : update the content of and . If you specify only one, the other will be emptied
- : update the content of and . You can specify only one, it will not empty the other one
- : update the content of and and put both to empty.
Example with a on :
Use the action to send a newsletter later. You just need to perform a request to schedule a new sending and to fill the property with a Timestamp format in ISO 8601 : http://www.iso.org/iso/home/standards/iso8601.htm You can also a schedule Here is an example :
To send a newsletter immediately, you have two possibilities :
- a new schedule with a Timestamp which value is
- use send (only is supported) For the second case, here is an example :
You can also test a newsletter by sending it to some specified recipients before making the real sending. To do so, you have to perform a request on a newsletter with action like in the following example :