How do i fix MailGun
Good Morning all, So the whole reason to move to Linode, was for one for a nice learning curve :) my hosting needed the extra freedom and i am loving Linode so far :D some days i want to pull my hair out but i often fix the issue :D.
The issue i am having is when i add :
Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;
First, instantiate the SDK with your API credentials
$mg = Mailgun::create('API');
Now, compose and send your message.
$mg->messages()->send($domain, $params);
$mg->messages()->send('preciousbusinessdirectory.co.uk', [
'from' => 'Excited User mailgun@preciousbusinessdirectory.co.uk',
'to' => 'Baz <myemail>',
'subject' => 'Hello',
'text' => 'Testing some Mailgun awesomness!'
]);</myemail>
it just deletes all of the code below, I've also checked the source code once loaded and 100% is vanishes, it makes no sense. It works on my localhost but for some reason no one here. I have copied everything exactly but am i being stupid, have i missed something.
Many Thanks
Simon
2 Replies
I'm not sure what guide you're going by, but if you could provide a link that might help one of us figure out what's going wrong.
Also, I notice that the code you're writing in, is directly in the command prompt; hence the $. It might be possible that some of that code needs to saved to text file and referenced to it instead of being put directly in the command line.
this is the guide i am using :) https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api
all of the code is PHP stored in my add.php file, all the guide says is to put it in the php i think :S