• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 942
  • Last Modified:

problem with mass email sending using aspMail object (delay to long)

Hi,
I am  presently having a small problem when sending multiple email using a loop with the aspMail object.

the nature of the problem is that it takes  about  8 to 9 seconds to send one email.
now say i have 200 email s  from a liste. well it will give us a long delay and long process to be able to send this batch of emails and it could  generate an   error  ( script   timeout ) .

my loop to do so is database driving so there a  --

 Do While Not monrs.eof --
 
     code for email (to one client)
  monrs.MoveNext
loop

then the code restarts en send to the second client
 


my question now...

is there away to make my code faster and smoother...?

my code is listed below...

presently im in averege of 8 to 9 seconds    

if typePreview = "SendMail" then
		'vas selection dans base de donner tout les emails
			dim MessageContact
		
			MessageContact = "La liste d'envoi ne contient aucun courriel."
				set monrs=server.CreateObject("ADODB.RECORDSET")
				
				sql="SELECT  member.* FROM member WHERE EmailTo = -1 "
				monrs.open sql,Conn,3,3
				
				dim checker
				
				if monrs.eof then
				response.write(MessageContact)
				else
					Do While Not monrs.eof
						
						Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
						Mail.FromName = "Conseil Québécois de la Franchise"
						Mail.FromAddress = "admin@yourpage.net"
						Mail.RemoteHost = "myremotehost.net" ' 
						Mail.AddRecipient  "cutomer", monrs("EmailMem")
						Mail.Subject    = txtSujet
						Mail.BodyText   = "<html><body><table width='600' border='0' cellspacing='0' cellpadding='0'><tr><td>"&TxtMessConvert&"</td></tr></table></body></html>"
						Mail.ContentType = "text/html"
						if Mail.SendMail then
						 %>
						<!--<div align="center"> 
						 <span class="style6">Le courriel a été envoyé.</span><a href="admin-ListeEnvoi.asp">Continuer</a></div> -->
				  <%
						else
						 %>
						 <div align="center"> 
							<span class="style6">Erreur 2. une erreur s'est produite </span><%=Mail.Response%><a href="cms-adminMembre.asp">Continuer</a>
							</div>
						
						<%
						end if
						
						
							
						monrs.MoveNext
					loop
					
					set monrs=nothing
					
					%>
					<div align="center"> 
						 <span class="style6">Le courriel a été envoyé.</span><a href="admin-ListeEnvoi.asp">Continuer</a></div>
					<%
				end if
				isSendMAil = true 
		end if'FIN typePreview = "SendMail"

Open in new window

0
SirTKC
Asked:
SirTKC
  • 4
  • 3
  • 2
1 Solution
 
DanielWillmottCommented:
Would it be possible to move the mail object creation to before the loop so it isn't created for each email?
if typePreview = "SendMail" then
		'vas selection dans base de donner tout les emails
			dim MessageContact
		
			MessageContact = "La liste d'envoi ne contient aucun courriel."
				set monrs=server.CreateObject("ADODB.RECORDSET")
				
				sql="SELECT  member.* FROM member WHERE EmailTo = -1 "
				monrs.open sql,Conn,3,3
				
				dim checker
				
				if monrs.eof then
				response.write(MessageContact)
				else
					Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
					Mail.FromName = "Conseil Québécois de la Franchise"
					Mail.FromAddress = "admin@yourpage.net"
					Mail.RemoteHost = "myremotehost.net" ' 
					Mail.Subject    = txtSujet
					Mail.BodyText   = "<html><body><table width='600' border='0' cellspacing='0' cellpadding='0'><tr><td>"&TxtMessConvert&"</td></tr></table></body></html>"
					Mail.ContentType = "text/html"
					Do While Not monrs.eof
						Mail.ClearAllRecipients	
						Mail.AddRecipient  "cutomer", monrs("EmailMem")
						if Mail.SendMail then
						 %>
						<!--<div align="center"> 
						 <span class="style6">Le courriel a été envoyé.</span><a href="admin-ListeEnvoi.asp">Continuer</a></div> -->
				  <%
						else
						 %>
						 <div align="center"> 
							<span class="style6">Erreur 2. une erreur s'est produite </span><%=Mail.Response%><a href="cms-adminMembre.asp">Continuer</a>
							</div>
						
						<%
						end if
						
						
							
						monrs.MoveNext
					loop
					
					set monrs=nothing
					
					%>
					<div align="center"> 
						 <span class="style6">Le courriel a été envoyé.</span><a href="admin-ListeEnvoi.asp">Continuer</a></div>
					<%
					Set Mail = Nothing
				end if
				isSendMAil = true 
		end if'FIN typePreview = "SendMail"

Open in new window

0
 
Abiel de GrootCommented:
In persitsASP I have this value:

Mail.Queue = True

When true the mail is sent to the queue rather tham being sent one by one.

Look uo your objects synax for this. There is sure to be one.
0
 
DanielWillmottCommented:
I checked version 4 of the component and it doesn't seem to offer any such ability.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Abiel de GrootCommented:
If you are sending multiple emails and do not use a queue object parameter you WILL encounter long delays

Emails are sent one by one and the web server has to negotiate with the smtp server for each send. The web server has to wait for a response from the mail server for each message. The Queue method simply put the messages in the mail servers Queue folder and thats it. By default the mail server will send messages from its queue folder in stacks of 50 so its much more efficient all round.

If the number is very great you may even encounter script time out.

Kind regards

A.
0
 
SirTKCAuthor Commented:
is there a way to do  a Mail.Queue = True
with aspMail and not aspEmail?
0
 
Abiel de GrootCommented:
I am not sure. A quick look over the code did not discover any queue parameter.

A word of warning... even persits aspMail only ship the Queue options with the full version which is not free. You are not aboe the use it on the free version.

A.
0
 
SirTKCAuthor Commented:
I'm using the mail services with 1and1  and  i can use these two objects!  aspMail and CDO

but i don't see any mail.queue

is there any free mail object that support this functionality
0
 
Abiel de GrootCommented:
>> free mail object that support this functionality

I doubt it. It would attract account from spammers. Being a registered object the server host has control over its use and can police it better.

A.
0
 
SirTKCAuthor Commented:

Look at that... You must be kidding me ? Right ?
 
Please before sending instant pre-formed message, read the whole case (all included below)... It's very frustrating for us - CUSTOMERS.
 
But because I am a nice guy and also patient to the extreme, let me give you a quick recap about our email problem (as you guys don't seem to read)
 
1. We use CDO with ASP Classic.
2. We purchased an external SMTP relay as you limit to 99 the qty of emails to be sent at the same time through any of your smtp servers.
3. Our script works fine on our IIS server with our new smtp relay service 4. Same script is NOT working on your server with our new smtp relay service 5. We can't switch to linux - that was a (...) suggestion.
6. Your version of ASPMail is obsolete and does NOT support smtp authentication - which we need.
7. Such limitation is NOT documented on ANY hosting specs and/or FAQ (excepted for the 99 emails)
 
Now please, just provide me an effective alternative instead of tell me "yes we can", "no we can't", etc.
 
You guys at 1and1 technical support are a JOKE ! Sorry. Even the three stooges would be more helpful.
 
Please accept my very best regards
 
 
 
-----Original Message-----
From: support@1and1.com [mailto:support@1and1.com]
Sent: April 23, 2009 1:41 PM
To:
Subject: RE:  - 1&1 Internet Support Re: Major problem with SMTP service
 
Dear
 
Thank you for contacting us.
 
We DO NOT block external smtp servers.  You can use any smtp servers in sending mass mails and it does not need any authentication or whatsoever, but we do not support when it comes to what software/scripts configuration. Bottomline is,  if your software does not supports CDO then you can switch to Linux in which there are open source softwares available and  commonly used by programmers.
 
If you have any further questions please do not hesitate to contact us.
 
--
Sincerely,
Melvin Alfonso
Technical Support
1&1 Internet
 
--------- to 1&1
> Now you,re telling me that switching to Linux will solve my problem ?
>
> If I understand clearly what you're saying is outgoing SMTP protocol
is not blocked on your firewall for Linux hosting packages and it is for Windows packages ?
>
> And what about the limitation of 99 emails for ANY 1and smtp sending
?
>
> I am very confused
>
> Can you clarify ?
>
> -----Original Message-----
> From: support@1and1.com [mailto:support@1and1.com]
> Sent: April 23, 2009 11:18 AM
> To:
> Subject: RE: C128867162 - 1&1 Internet Support Re: Major problem with
SMTP service
>
> Dear
>
> Thank you for contacting us.
>
> Switching to a Linux platform could be your alternative option as you
can use Formmail or phpmail CGI in sending mass emails.
>
> If you have any further questions please do not hesitate to contact
us.
>
> --
> Sincerely,
> Melvin Alfonso
> Technical Support
> 1&1 Internet

> --------- to 1&1
> > OK fine,
> >
> > Now what is the solution ? Because The version of ASPMail you're
using
> is obsolete, CDO does not work, We can't send more then 99 emails at
the same time.
> >
> > What else do you propose ?
> >
> > Thanks
> >
> > -----Original Message-----
> > From: support@1and1.com [mailto:support@1and1.com]
> > Sent: April 23, 2009 1:51 AM
> > To:
> > Subject: RE: C128867162 - 1&1 Internet Support Re: Major problem
with
> SMTP service
> >
> > Dear
> >
> > Thank you for contacting us.
> >
> > With regard to your query, creating a connection from the webspace
> towards your external host is not possible. As I have analyzed CDO is
a component of ASP and unfortunately our firewall blocks all outgoing connection from our server. In short, using CDO to connect from the
> > 1and1 webspace to mail.authsmtp.com is not possible.
> >
> > If you have any further questions please do not hesitate to contact
> us.
> >
> > --
> > Sincerely,
> > Charisma Teves
> > Technical Support
> > 1&1 Internet
> >
--------- to 1&1
> > > Hi,
> > >
> > > Yes, again, your firewall is blocking outgoing smtp traffic. We
> have
> > tried BOTH CDO as well as CDOSYS on our internal server and it work
> just fine. As soon as we redeploy on your server we cannot connect to
our smtp provider. On top they also provides alternate Now you MUST investigate deeper and I do insist that you pass this request to a competent senior technical level so I can have the required intervention made so we can proceed with or service normaly.
> > >
> > > Thanks
> > >
> > > -----Original Message-----
> > > From: support@1and1.com [mailto:support@1and1.com]
> > > Sent: April 22, 2009 2:41 PM
> > > To:
> > > Subject: RE: C128867162 - 1&1 Internet Support Re: Major problem
> with
> > SMTP service
> > >
> > > Dear Customer,
> > >
> > > Thank you for contacting us.
> > >
> > > This is with regard to your recent email. I have read your case.
We
> > are not blocking external outgoing smtp traffic. The traffic is not
> already on our end since you used external smtp. We allow you to use
external smtp server and if there's any problem in sending, it is something to do on that server and not with us. By the way, are you using CDO in sending email? We only support CDOSYS.
> > >
> > > If you have any further questions please do not hesitate to
contact
> > us.
> > >
> > > --
> > > Sincerely,
> > > Odessa Cabanog
> > > Technical Support
> > > 1&1 Internet
> > >
--------- to 1&1
> > > > Hi,
> > > >
> > > > YES you do block outgoing smtp traffic. Stop saying NOT.
> > > > We have tried our solution on our server and it work
beautifully.
>
> > > > As soon as we try it on your server, it is not working anymore.
> > > >
> > > > And the proof you don't know what you're talking about is that
> > there
> > > is NO relation with OUR ISP since this transmission starts from
> YOUR
> > server to our new smtp service provider.
> > > >
> > > > So please, stop sending me superficial answers and just pass
this
> > > issue to a senior level. So they can at least understand what I
am
> > talking about here and stop making me lose my time reading useless
> emails.
> > > >
> > > > Thank you for your understanding.
> > > >
> > > >
> > > > Architecte TI & Web
> > > >
> > > >
> > > > AVERTISSEMENT CONCERNANT
> > > > LA CONFIDENTIALITE
> > > >
> > > > Ce courriel, son contenu et ses pièces jointes sont
confidentiels
> > et
> > > sont exclusivement adressés à son destinataire principal et aux
> autres
> > destinataires indiqués. Si vous avez reçu ce message alors que vous
> n'êtes pas un destinataire designé, veuillez en aviser immediatement
l'émetteur et détruire ce message et les pièces jointes.
> > > > WARNING REGARDING
> > > > CONFIDENTIALITY
> > > >
> > > > This e-mail contains proprietary information and may be
> > confidential.
> > > If you are not the intended recipient of this Email, you are
hereby
> > notified that any dissemination, distribution or copying of this
> message is strictly prohibited. If you received this message by
mistake or in error, please delete it immediately and advise the author.
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: support@1and1.com [mailto:support@1and1.com]
> > > > Sent: 22 avril 2009 04:13
> > > > To:
> > > > Subject: RE: C128867162 - 1&1 Internet Support Re: Major
problem
> > with
> > > SMTP service
> > > >
> > > > Dear Customer,
> > > >
> > > > Thank you for contacting us.
> > > >
> > > > We do not block outgoing smtp. You may contact your ISP since
> they
> > > are
> > > > the only one who can block incoming and outgoing servers. You
> may
> > > also
> > > > try to disable your firewall and anti virus and do a test
again.
> > > >
> > > > If you have any further questions please do not hesitate to
> contact
> > > us.
> > > >
> > > > --
> > > > Sincerely,
> > > > Khristofer Mozo
> > > > Technical Support
> > > > 1&1 Internet
> > > >
> > > >
> > > >
> > > > > Please would you verify deeply what I've asked below.
> > > > >
> > > > > I have just used YOUR script on OUR physical server and it
> worked
> > > on
> > > > the
> > > > > first try.
> > > > >
> > > > > The same script is not working on you server at all. So I
doubt
> > > that
> > > > you
> > > > > took the time to verify if the outgoing smtp traffic to any
> > > external
> > > > > smtp server provider.
> > > > >
> > > > > Error message
> > > > >
> > > > > ==========================================
> > > > > test with port 2525
> > > > >
> > > > > CDO.Message.1 error '80040213'
> > > > >
> > > > > The transport failed to connect to the server.
> > > > >
> > > > > /emailTESTER_2.asp, line 39
> > > > > ==========================================
> > > > >
> > > > > Please take your time and verify.
> > > > >
> > > > > Thanks
> > > > >
> > > > > -----Original Message-----
> > > > > From: support@1and1.com [mailto:support@1and1.com]
> > > > > Sent: April 22, 2009 2:25 AM
> > > > > To:
> > > > > Subject: C128867162 - 1&1 Internet Support Re: Major problem
> with
> > > > SMTP
> > > > > service
> > > > >
> > > > > Dear Customer,
> > > > >
> > > > > Thank you for contacting us.
> > > > >
> > > > > Regarding your concern, it is fine to use your external SMTP
> > server
> > > > to
> > > > > send out an email. Also , we do not block the said connection
> to
> > > your
> > > > > SMTP server.
> > > > >
> > > > > If you have any further questions please do not hesitate to
> > contact
> > > > us.
> > > > >
> > > > > --
> > > > > Sincerely,
> > > > > Jomar Villar
> > > > > Technical Support
> > > > > 1&1 Internet
> > > > >
> > > > > > Hi, (Customer ID:)
> > > > > >
> > > > > > We are trying to implement an email script using CDO. We
will
> > be
> > > > > using
> > > > > > this to send updates to our members. We found out this week
> > that
> > > we
> > > >
> > > > > > cannot send more then 99 emails via your smtp servers -
> because
> > > > we've
> > > > > > been told that it's a limitation policy. So be it. We
decided
> > to
> > > > > enroll
> > > > > > to an external SMTP service but we just can't send any of
our
> > > > tests.
> > > > > >
> > > > > > Are you blocking outgoing smtp traffic to any outside smtp
> > > services
> > > > ?
> > > > > > Can you try to telnet mail.authsmtp.com 25
> > > > > >
> > > > > > and then try:
> > > > > >
> > > > > >   telnet mail.authsmtp.com 2525
> > > > > >
> > > > > > What did you get each time?
> > > > > >
> > > > > > Basically you need to check you are not blocking access to
> > > external
> > > >
> > > > > > ports / SMTP servers.
> > > > > >
> > > > > >
> > > > > > Also, ASPMail that you have available for email scripting
is
> > quiet
> > >
> > > > > > obsolete. It cannot even handle smtp auth. So only CDO
> remains
> > > > > >
> > > > > > You MUST find us a solution to get us out of this trap.
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > >
> > > > > > Chief Engineer
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
>



0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now