Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fatal Error - Class 'Mailgun\Mailgun' not found in /var/www/mysite/fuel/packages/email/classes/em
  • I'm trying to use mailgun as my email service now. I did follow the steps (http://fuelphp.com/docs/packages/email/usage.html#/mailgun) on my local and it works, I was able to send email and I check my mailgun account and it was there telling me that I was able to send an email.

    When uploading it on my real server. I uploaded the following.
    vendor/mailgun
    vendor/symfony
    vendor/guzzle
    app/config/email.php (email config for mailgun)

    But I got this error when I'm trying to send an email.

    Fatal Error - Class 'Mailgun\Mailgun' not found in /var/www/mysite/fuel/packages/email/classes/email/driver/mailgun.php on line 25

    This is one of my codes of sending email.

    $body = View::forge("email/students/cancel_lesson");
    $body->set("name", $this->user->firstname);
    $body->set("reservation", $del_reserve);
    $sendmail = Email::forge("JIS");
    $sendmail->from(Config::get("statics.info_email"),Config::get("statics.info_name"));
    $sendmail->to($this->user->email);
    $sendmail->subject("Cancellation of Lesson / mysite");
    $sendmail->html_body(htmlspecialchars_decode($body));

    $sendmail->send();

    I was thinking maybe I should change the $sendmail to $mailgun? But it's confusing me because I was able to send an email in my local.
  • Looks like your missing a lot of composer stuff, in particular vendor/composer, which contains the composer autoloader and the autoloader configuration.

    Since you are getting no error that the composer autoloader is missing, my guess is that you have an old version of vendor/composer on your server, that doesn't have the namespace for Mailgun registered.
  • I see. Thanks, I updated my composer in my local using commandline, would it be okay if I will upload my vendor/composer folder to my server?
  • Not sure, we only use dedicated servers and deploy using git (so composer runs on the servers).

    I suggest you do it and see if it helps. When you run a composer install or update it will generate the autoloader files in vendor/composer with the namespaces of the packages hardcoded in it, so you have to make sure your vendor folder is always transferred completely.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion