Shaggie
Shaggie

Reputation: 1829

Class 'Mandrill\Struct' not found while using mandrill api to send mail

I am using mandrill's api for sending email through my project made in core php. i followed steps as given here

Instead of adding as 'use' i have included the respective files in my page & called the api. But it has shown me the above error. The architecture of api is little bit framework like. I havent worked on framework yet. Don't have any idea how it can be resolved.

i did following

include '../api/mandrill-api-php/vendor/autoload.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Mandrill.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Struct/Message.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Struct/Recipient.php';

it is showing me error class mandrill not found.

Upvotes: 0

Views: 601

Answers (1)

Honza Haering
Honza Haering

Reputation: 812

Including only those 3 dependencies is not enough, because mandrill has other dependencies on its classes. What you could do is install the mandrill-api using composer as suggested in mandrill-api readme:

php composer.phar require jlinn/mandrill-api-php:~1.0

Then, in your php, include the autoload file:

require 'vendor/autoload.php';

Upvotes: 1

Related Questions