Re: Email From a list
Thanks! I got it work and send emails to the people i select. I do get an error message shortly after the email sends.
The error says this:
Error
Uncaught Error of type [Swift_ConnectionException] with message [There was a problem reading line 1 of an SMTP response. The response so far was:
[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps? (fsockopen: #0) ]
@0 Email_apl::controle() in C:Program FilesNetMakev5wwwrootscriptcaseappApprovalEmailEmail.php on line 2083
@1 Email_apl::Submit() in C:Program FilesNetMakev5wwwrootscriptcaseappApprovalEmailEmail.php on line 1181
@2 Swift::send() in C:Program FilesNetMakev5wwwrootscriptcaseappApprovalEmailEmail.php on line 1418
Any thoughts?
Here is the code I am useing:
$tot = count([total_chked]);
$contacts = "";
for($x=0;$x<$tot;$x++){
$contacts .= [total_chked][$x];
if($x == ($tot-1)){
$contacts .= "";
}else{
$contacts .= "; ";
}
}
/**
* Send a simple email
*/
// Email parameters
$mail_smtp_server = '192.168.xx.xxx'; // SMTP server name or IP address
$mail_smtp_user = ''; // SMTP user name
$mail_smtp_pass = ''; // SMTP password
$mail_from = 'no-reply@ouremail.com'; // From email
$mail_to = $contacts; // To email
$mail_subject = 'Request Waiting For Approval'; // Message subject
$mail_message = 'You have new requests in your que that need to be approved. Please log into the HSS Approval database by clicking <a href="http://approvals.hss-mms.com/approval">Here</a>.'; // Message body
$mail_format = 'H'; // Message format: (T)ext or (H)tml
// Send email
sc_mail_send($mail_smtp_server,
$mail_smtp_user,
$mail_smtp_pass,
$mail_from,
$mail_to,
$mail_subject,
$mail_message,
$mail_format);
echo "<table width='300px' border='1' bordercolor='#000000' cellpadding='0' cellspacing='0'>
<tr>
<td colspan='2'><strong> ($tot) An email was sent to: <strong></td>
</tr>
<tr>
<td><font color='#003366'><strong> $contacts </strong></font> </td>
</tr>
</table>"
;