How to set phpMailer correctly to be integrated with MIAB?


#1

This phpMailer was working well with smtp.gmail.com BUT not with mail server from MIAB, please anyone suggestion how to put this phpmailer correctly ?, here below is phpmailer as I meant.
Thanks for advance.

<?php defined('BASEPATH') OR exit('No direct script access allowed.'); $config['useragent'] = 'PHPMailer'; $config['protocol'] = 'smtp'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['smtp_host'] = 'MAIL SERVER FROM MIAB'; $config['smtp_user'] = 'EMAIL ACCOUNT FROM MIAB'; $config['smtp_pass'] = 'PASSWORD EMAIL ACCOUNT FROM MIAB'; $config['smtp_port'] = 587; $config['smtp_timeout'] = 30; $config['smtp_crypto'] = 'tls'; $config['smtp_debug'] = 0; $config['smtp_auto_tls'] = false; $config['smtp_conn_options'] = array(); $config['wordwrap'] = true; $config['wrapchars'] = 76; $config['mailtype'] = 'html'; $config['charset'] = null; $config['validate'] = true; $config['priority'] = 3; $config['crlf'] = "\n"; $config['newline'] = "\n"; $config['bcc_batch_mode'] = false; $config['bcc_batch_size'] = 200; $config['encoding'] = '8bit'; $config['dkim_domain'] = ''; $config['dkim_private'] = ''; $config['dkim_private_string'] = ''; $config['dkim_selector'] = ''; $config['dkim_passphrase'] = ''; $config['dkim_identity'] = '';

#2

What error messages are you getting? What do your relevant log entries look like?


#3

ok, i will search the error log in later while…


#4

Dec 19 19:43:06 box postfix/smtpd[19753]: warning: hostname sky-78-19-126-220.bas512.cwt.btireland.net does not resolve to address 78.19.126.220: Name or service not known
Dec 19 19:43:06 box postfix/smtpd[19753]: connect from unknown[78.19.126.220]
Dec 19 19:43:06 box postfix/smtpd[19753]: disconnect from unknown[78.19.126.220]

That’s all above recorded, and the site which supposed to access this MIAB is using cloudflare anyway…


#5

it seems the website tried to log in MIAB but eventually failed, something wrong in MIAB i guessed. Maybe there is definite setting so another app will be able to log in MIAB…do you know what is it?


#6

so like this, how the login process to MIAB was failed…


#7

The logs seem to be from MiaB, not from the sending server … what do the logs on that server say?


#10

here on the website server


#11

Not sure why you keep deleting your posts. Nobody can help without data. Anyways ,

I did get to see the latest one before it was deleted. I can ascertain that you are having authentication issues, so the first thing to check is that the accounts are set up within MiaB that you are trying to authenticate with and that the passwords are correct on the php side of things.


#12

well, i put in the phpmailer are correct credentials…
smtp_host, port, and email account and its password.
Sorry deleting thing, i just tried to put the proper pic one before i share here…


#13

I tested the below code works for me:

<?php
defined('BASEPATH') OR exit('No direct script access allowed.');
$config['useragent']           = 'PHPMailer';
$config['protocol']            = 'smtp';
$config['mailpath']            = '/usr/sbin/sendmail';
$config['smtp_host']           = 'mail.example.com';
$config['smtp_user']           = 'username@example.com';
$config['smtp_pass']           = 'SomeRandomPassword';
$config['smtp_port']           = 587;
$config['smtp_timeout']        = 30;
$config['smtp_crypto']         = 'tls';
$config['smtp_debug']          = 0;
$config['smtp_auto_tls']       = true;
$config['smtp_conn_options']   = array();
$config['wordwrap']            = true;
$config['wrapchars']           = 76;
$config['mailtype']            = 'html';
$config['charset']             = null;
$config['validate']            = true;
$config['priority']            = 3;
$config['crlf']                = "\n";
$config['newline']             = "\n";
$config['bcc_batch_mode']      = false;
$config['bcc_batch_size']      = 200;
$config['dkim_domain']         = '';
$config['dkim_private']        = '';
$config['dkim_private_string'] = '';
$config['dkim_selector']       = '';
$config['dkim_passphrase']     = '';
$config['dkim_identity']       = '';

$mail = new PHPMailer(true);  
$mail->SMTPDebug = 2; 
$mail->isSMTP();
$mail->Host = $config['smtp_host'];
$mail->Port = $config['smtp_port'];
$mail->Username = $config['smtp_username'];
$mail->Password = $config['smtp_password'];
$mail->SMTPSecure = $config['smtp_crypto']; 



?>

(Also next time you post some code, use the code tags or preformatted text. :wink: )


#14

Aha! That was one that caught my eye. Let’s see if this solves the OP’s issue. :slight_smile:


#15

awesome…you are my hero and the hero of many other who failed to notice this caught…
i m sorry for did not know how to write piece of sources code on here till it became messy like that was…
but amazingly your eye is an eagle one, and that “tls false” was the culprit of all recently nightmares of mine…
thanks so much Brother Murgero…


#16

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.