A new idea of mass mailing by using Asp+jmail

Source: Internet
Author: User
Tags mssql
Email address is stored in the MSSQL User Information table, the number of tens of thousands.
Company own server, set Smtp,pop3,www,ftp,mssql,dns and other services in one.
JMail has MailMerge objects, but the free version is not available
Requirements:
Use Asp+jmail to send email to all users using company SMTP
Ideas:
Directly read the database, multiple loops to send, will not be configured high server caused a lot of pressure.
It is best to send the email in batches, send each batch interval for a period of time, in order to alleviate the pressure caused by the server.
Realize:
To email in batches
read out records to the recordset, take advantage of common paging programs, paging all records, each page as a batch, how many pages are divided into batches
Interval delay
After the completion of each page with <meta http-equiv= "Refresh" content= "60; Url=sendmail.asp?page= &page> to delay the jump
Reduce execution Time:
In the loop, you loop through adding the recipient instead of looping through the
For I=1 to Rs.pagesize
Msg. AddRecipient rs ("Email")
Rs.movenext
Next
Msg. Send ("smtp.abc.com")
Reduce message size
Loop to add a recipient, will cause a lot of email to the recipient, such an email will be very large.
So, in the above code based on the improvement, in the loop to make a judgment, when the recipient email number arrived
Send it once when you are 20. That
For I=1 to Rs.pagesize
Msg. AddRecipient rs ("Email")
If I mod = 0 Then ' every 20 addressee as an email sent once
Msg. Send ("smtp.abc.com")
Msg. Clearrecipients ' Clears the sent recipient
End If
Rs.movenext
Next
Msg. Send ("smtp.abc.com") ' sends the remaining
Page
Mail.asp contains the message subject, body form, <form action= "sendmail.asp" target= "send" >; an iframe page, <iframe name= "send" src= " Sendmail.asp ">
Sendmail.asp includes background send program, loop, delay jump, etc.
Disadvantages:
Cannot leave the page during the send process
A long time to send, related to the number of sent per batch, network bandwidth, SMTP server performance
Improved:
You can include multiple iframe pages in the mail.asp, each page starting from a different page, which is equivalent to multi-threaded sending,
The pressure on the SMTP server increases, but it can shorten the delivery time.
Consider using different SMTP servers in different pages, such as a multiple IFRAME page, with an even page
Smtp.abc.com, with smtp.123.com on odd pages. This will reduce server pressure, but also to achieve multithreading to send
Shorten the purpose of sending time.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.