Mailjet und Pear Codevorlagen

integration with PEAR's Email library

1) Use

 
<?php
 
require_once "Mail.php";
 
$headers = array ('From' => 'You <your_sender@address.com>',
   		  'Subject' => 'My first email by Mailjet');
 
$smtp = Mail::factory('smtp',
   		      array ('host' => 'ssl://in.mailjet.com',
     		      	     'port' => 465,
     		             'auth' => true,
     		             'username' => 'your_Mailjet_API_Key',
     		             'password' => 'your_Mailjet_Secret_Key'));
 
$mail = $smtp->send('Somebody <recipient@example.com>', $headers, 'Hello from Mailjet & PEAR !');
 
?>
 

You have to edit only these configuration parameters :

- 'smtp_host' : ssl://in.mailjet.com if you want use SSL secure mode, tls://in.mailjet.com for TLS secure mode or in.mailjet.com for no encryption.
- 'smtp_port' : the port used to transport your emails (465, 587, 588, 25)
- 'smtp_user' : it's your API Key
- 'smtp_pass' : it's your Secret Key.

Others parameters must not be edited.

Do not forget to edit your sender address "from".

2) More

http://pear.php.net