+ Reply to Thread
Page 4 of 5 FirstFirst ... 2 3 4 5 LastLast
Results 31 to 40 of 41

Thread: Sending Email Asynchronously

  1. #31
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Quote Originally Posted by micky View Post
    I can remove that.

    But ironically, now the code is showing emails in TO field again and also sending mails with different number of recipients to same person.
    Darn
    sorry, its working fine now
    Also i have also removed EnableEventValidation="false"

    My question is J, that is the code efficient if it has to send say 100 mails??
    I mean i have defined everything in the loop, so it would define 100 times.

  2. #32
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Give me a second..I'm going to post an email class we use here. Also, just another thought...I know of some developers that use the database and have a form of a mail queue to help process large numbers of emails in batches....just something to consider.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #33
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Quote Originally Posted by jmurrayhead View Post
    I know of some developers that use the database and have a form of a mail queue to help process large numbers of emails in batches....just something to consider.
    Any idea on how to do that?

  4. #34
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    See my sample Email class here: http://www.developerbarn.com/net-cod...-new-post.html

    Basically, instead of passing the entire array of email ID's to the function, you should just call this function in a loop.

    As far as the database mail queue...you could have a table like so:
    MailQueueId
    DateLine
    ToEmail
    FromEmail
    Subject
    Message

    Then have some sort of scheduled task that queries for the TOP 100 records and shoots of an email, for example. This task could be run every x minutes.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  5. #35
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Thanx J, i'll have a look at the link.

    I need to send mail on button click, its like an mail for an update for a match.
    So i have to get all people subscribed to that match and send them mail.
    Since this number can be huge, thats why i am sending mail asynchronously.

  6. #36
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Right M, on the button click, it would populate the mail queue. Then, have the scheduled task set for every 5 minutes or so. It will be instantaneous enough, yet, send emails in batch. Once the email is sent for the TOP x users, then you clear them from the database.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #37
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Hmm, thanx J
    I'll see how it goes.

    And thanx for that email class

  8. #38
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    M, for the email class that I showed you, you will only be passing one email address to it through each iteration of the loop. As I mentioned above, the SendMail function will be called in a loop, but you won't pass the entire string of email IDs, just one of them each time.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #39
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Quote Originally Posted by jmurrayhead View Post
    M, for the email class that I showed you, you will only be passing one email address to it through each iteration of the loop. As I mentioned above, the SendMail function will be called in a loop, but you won't pass the entire string of email IDs, just one of them each time.
    J, then i already have that kind of thing in my code (in post #28 above) that works fine.

  10. #40
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Quote Originally Posted by micky View Post
    J, then i already have that kind of thing in my code (in post #28 above) that works fine.
    True, but it's not reusable You have hard coded values...my class uses functions that can be used over and over again within the application
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 4 of 5 FirstFirst ... 2 3 4 5 LastLast

Similar Threads

  1. Sending Emails Using ASP.NET
    By richyrich in forum .NET Code Samples
    Replies: 5
    Last Post: July 6th, 2009, 05:21 AM
  2. Sending HTML email...
    By bryceowen in forum PHP Development
    Replies: 3
    Last Post: April 8th, 2009, 08:28 PM
  3. Excel and Email
    By Chrissy in forum ASP Development
    Replies: 10
    Last Post: February 16th, 2009, 09:11 PM
  4. Sending Email with ASP and CDOSYS
    By jmurrayhead in forum ASP Code Samples
    Replies: 1
    Last Post: November 13th, 2008, 09:26 AM
  5. Sending Email using CDOSYS & Classic ASP
    By richyrich in forum ASP Code Samples
    Replies: 0
    Last Post: March 17th, 2008, 10:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO