Hello
im unable to send email from a compute instance in OCI using mailgun for php
mailgun told me that it sould be the server, this same code runs Ok in another server (GCP), but it only fails in my OCI instances. Please please help me!
Error:
Failed to connect to smtp.mailgun.org:465 [SMTP: Failed to connect socket: Permission denied (code: -1, response: )] )
code:
$host = "smtp.mailgun.org";
$username = "sender@mail.actasgobmx.com";
$password = "mypass";
$port = "465";
$to = "gelantibacterialmx@yahoo.com";
$email_from = "sender@mail.actasgobmx.com";
$email_address = "replyto@sender.com";
$content = "text/html; charset=utf-8";
$mime = "1.0";
$random = uniqid();
$email_subject ="yest";
$params = array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password);
$smtp = Mail::factory ('smtp', $params);
/*
$mail->addReplyTo('ing.cristobalfi111@gmail.com', 'Admin Actas');
//Set who the message is to be sent to
$mail->addAddress('ing.cristobalfi111@gmail.com', 'Admin Actas ');
*/
//Set the subject line
$random = uniqid();
$html = "<h1> Nuevo pedidio Gel Antibacterial</h1><br>";
$email_body =$html;
$headers = array ('From' => $email\_from,
'To' => $to,
'Subject' => $email_subject,
'Reply-To' => $email_address,
'MIME-Version' => $mime,
'Content-type' => $content);
$params = array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password);
$smtp = Mail::factory ('smtp', $params);
$mail = $smtp->send($to, $headers, $email_body);