Run nurunpdf from PHP
Posted: Thu Dec 12, 2024 4:44 pm
Hello
Is there a way to run a report save directly in PHP ??
Is there a way to run a report save directly in PHP ??
Code: Select all
function build_invoice_list(){
window.file_list = [];
var inv = window.invoices;
for(var i = 0 ; i < inv .length ; i++){
nuSetValue('INVOICE_NUMBER', inv[i][0]);
nuRunReportSave('INV', window.invoices[i][1], email_invoice_list);
}
}
function email_invoice_list(a){
var inv = window.invoices;
var ino = window.invoices[window.file_list.length];
window.file_list.push([ino[1]+'.pdf', a]);
if(window.file_list.length == window.invoices.length){
nuRunPHPHiddenWithParams(window.INVOICE_TYPE, 'attachments', file_list, 1);
}
}
Is php's sendmail function good for sending bulk emails?
chatGPT wrote: Using PHP's mail() function (or sendmail) for sending bulk emails is generally not recommended for several reasons:
Limitations of PHP's mail() Function
Performance Issues:
The mail() function is not optimized for sending a large number of emails. Each call initiates a new connection to the mail server, which can be slow and resource-intensive.
Lack of Tracking:
The mail() function does not provide any built-in features for tracking email opens, bounces, or delivery status.
Scalability:
Sending thousands of emails using mail() can overwhelm your server resources, especially if your hosting plan has limited processing power or memory.
Risk of Being Marked as Spam:
Emails sent through mail() often lack proper headers (e.g., SPF, DKIM) and are more likely to be flagged as spam by recipient servers.
Shared hosting servers, in particular, are often blacklisted due to misuse by others on the same server.
No Queue Management:
There is no way to manage or queue emails efficiently. If your server crashes mid-process, you may lose track of which emails were sent.
Alternatives for Sending Bulk Emails
For bulk email campaigns, consider using more robust solutions:
1. Email Libraries:
Use libraries like PHPMailer or SwiftMailer with an SMTP service. These libraries offer better control, error handling, and support for advanced features like attachments, HTML emails, and headers.
2. Dedicated Bulk Email Services:
Services like Mailchimp, SendGrid, Amazon SES, Postmark, or Brevo (formerly Sendinblue) are specifically designed for bulk emails. They provide features like:
Delivery tracking
Bounce handling
Rate limiting
Compliance with spam regulations
Built-in templates and analytics
3. Self-Hosted Email Sending Solutions:
Use a tool like Postal or Mautic on a dedicated server. These tools allow you to set up and manage your own bulk email campaigns while handling the complexities of email deliverability.
4. Message Queues:
Implement a message queue system (e.g., RabbitMQ, Redis, or Amazon SQS) to manage the load and ensure emails are sent in a controlled and timely manner.
Conclusion
The mail() function is fine for sending a few emails in simple applications, but it is not a practical or reliable solution for bulk emailing. Using a professional email-sending service or a dedicated library with SMTP support is a much better approach for handling large volumes of email.
Code: Select all
for($i = 1; $i <= 1000; $i++) {
$mail = @mail($to, $subject.$i, $message, $headers, $returnpath);
}
Code: Select all
(host mx5.wp.pl[123.123.123.123] said: 421 service temporarily unavailable (in reply to DATA command))