批量邮寄表演发送方式 [英] Bulk Mailing Performance Sending Method

查看:212
本文介绍了批量邮寄表演发送方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个邮件脚本phpmailer / swiftmail支持。实际上,小型广告系列运作正常,所有邮件都会到达接收者,而不会发生垃圾邮件或服务器资源问题。



我对每个连接发送的性能有疑问。哪种方式更适合发送动作? (订阅者具体不同的邮件正文)



第一种情况;





  • 在任务列表上抓取100个订阅者

  • 替换每个订阅者的新闻稿数据/标题并保存到新数组

  • 调用PhpMailer - 通用SMTP连接设置




  $ mail - > SMTPKeepAlive = true; 
foreach($ newArray as $ k => $ v){
$ mail-> AddAddress($ k,$ v ['name']);
$ mail-> Subject = $ v ['subject'];
$ mail-> Body = $ v ['content'];
$ mail-> Send();
}
$ mail-> smtpClose();


第二种情况(我的脚本上的当前方法,我打电话phpmailer类进入记录循环);




  • 打开新闻信息

  • 打开任务列表100记录< $($ rs = $ sql-> fetch_assoc())
    $ / $ ){
    替换电子报数据/头
    调用PhpMailer - 通用SMTP连接设置
    $ mail-> SMTPKeepAlive = true;
    $ mail-> AddAddress($ rs ['mail'],$ rs ['name']);
    $ mail-> Subject = $ campRs ['subject'];
    $ mail-> Body = $ campRs ['content'];
    $ mail-> Send();
    }
    $ mail-> smtpClose();


    我很困惑,如果我去大量邮件列表,任何服务器或脚本问题可能会发生?



    最好的问候!

    解决方案>

    绝大多数时间用于发送电子邮件是您的Web服务器与正在与之通话的SMTP服务器之间的SMTP通信。



    这两种情况都可能



    如果您需要提高性能,请查看有多个线程同时发送到不同的电子邮件地址。


    I wrote a mailing script phpmailer/swiftmail supported. Actually small campaigns works fine, all mails arrive to receivers without spam or server resouce problems.

    I have question about per connection sending performance. Which way better for sending action? (Subscriber specific different mail body)

    First scenario;

    • Open Newsletter Data
    • Catch 100 Subscriber on task list
    • Replace Newsletter Data/Header For Each Subscriber and Save to New Array
    • Call PhpMailer - Common SMTP Connection settings

    $mail->SMTPKeepAlive = true;
    foreach($newArray as $k=>$v){
      $mail->AddAddress($k, $v['name']);
      $mail->Subject  =  $v['subject'];
      $mail->Body = $v['content'];
      $mail->Send();
    }
      $mail->smtpClose();
    

    Second scenario (Current method on my script, I've call phpmailer class into record loop);

    • Open Newsletter Data
    • Open Task List 100 record

    while($rs = $sql->fetch_assoc()){
      Replace Newsletter Data/Header
      Call PhpMailer - Common SMTP Connection settings
      $mail->SMTPKeepAlive = true;
      $mail->AddAddress($rs['mail'], $rs['name']);
      $mail->Subject  =  $campRs['subject'];
      $mail->Body = $campRs['content'];
      $mail->Send();
    }
      $mail->smtpClose();
    

    I'm confused about that, if I go for large amount mailing list, any server or script problems may occur?

    Best regards!

    解决方案

    The vast majority of time spent sending an email is the SMTP communication between your web server and the SMTP server it is talking with.

    Both scenarios are likely to be equivalently fast.

    If you need to increase performance, look into having multiple threads sending to different email addresses concurrently.

    这篇关于批量邮寄表演发送方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆