0

I've tired to sending email with tracking, and i found solution mailgun, i'm using codeigniter framework and swift library for sending email,

this is my code

require_once 'lib/swift_required.php';

    $email = $this->input->post('to');
    $subject = $this->input->post('subject');
    $message_body = $this->input->post('isi');

    $transport = Swift_SmtpTransport::newInstance('smtp.mailgun.org', 465, "ssl")
    ->setUsername('myUsernameSMTP') 
    ->setPassword('myPasswordSMTP'); 

    $mailer = Swift_Mailer::newInstance($transport);

    $message = Swift_Message::newInstance($subject) 
              ->setFrom(array('krisman.ryuzaki@gmail.com' => 'Ahmad Krisman R.')) 
              ->setTo($email) 
              ->setBody($message_body, 'text/html'); 

    if($result = $mailer->send($message)) {
            redirect('pemasaran/index', 'refresh');
    }

can anybody help please

Zeeshan
  • 803
  • 6
  • 15
  • Did you try setting it to port 25. To see if that helps. And remove ssl. If that helps than it might be your port and ssl setup. See http://stackoverflow.com/questions/36841051/swiftmailer-connection-could-not-be-established-with-host-smtp-mailgun-org – Puya Sarmidani Sep 29 '16 at 11:02
  • If you getting authentication error with your `gmail` id despite correct credentials then you need to allow less secure app in your gmail accounts security settings. http://www.google.com/settings/security/lesssecureapps – Zeeshan Sep 29 '16 at 11:48
  • i've been try to change all setting parameter, im using mailgun for tracking send email, do you have suggest for tracking send email with php ? – ahmadryuzaki Oct 01 '16 at 04:35

0 Answers0