Been a long time MailWizz user.
Just saw it got updated to v2 (yes, I am late to the party). I have a question. Was the feature to limit send rate per IP address added, or maybe the ability to send outgoing emails using different IP addresses? Some service providers limit the number of API/SMTP sends that can be executed per IP address. I have been using custom code (directly modifying the code in \apps\common\models for the DeliveryServer that I use) to shift between outgoing IP addresses via cURL. However, this type of feature would be better if added to MailWizz directly.
Here is my code:
Just saw it got updated to v2 (yes, I am late to the party). I have a question. Was the feature to limit send rate per IP address added, or maybe the ability to send outgoing emails using different IP addresses? Some service providers limit the number of API/SMTP sends that can be executed per IP address. I have been using custom code (directly modifying the code in \apps\common\models for the DeliveryServer that I use) to shift between outgoing IP addresses via cURL. However, this type of feature would be better if added to MailWizz directly.
Here is my code:
Code:
//$response = AppInitHelper::simpleCurlPost('https://api.elasticemail.com/v2/email/send', $postData, (int)$this->timeout);
$ch = curl_init('https://api.elasticemail.com/v2/email/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)$this->timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, (int)$this->timeout);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'MailWizz/' . MW_VERSION);
if (ini_get('open_basedir') == '' && ini_get('safe_mode') != 'On') {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
}
$ipAddress123 = array('xxx.xxx',
'yyy.yyy',
'zzz.zzz');
shuffle($ipAddress123);
curl_setopt($ch, CURLOPT_INTERFACE, $ipAddress123[0]);
$body = curl_exec($ch);
$curlCode = curl_errno($ch);
$curlMessage = curl_error($ch);
$httpCode = 200;
if (!$curlCode && defined('CURLINFO_HTTP_CODE')) {
$httpCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
}
curl_close($ch);
if ($curlCode !== 0) {
$response = array('status' => 'error', 'message' => $curlMessage, 'error_code' => $curlCode, 'http_code' => $httpCode);
}
$response = array('status' => 'success', 'message' => $body, 'error_code' => 0, 'http_code' => $httpCode);