Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to send mail from multiple threads simultaneously and get notified of delivery?

How to send mail from multiple threads simultaneously and get notified of delivery?

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasedotnetcomsysadmin
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Waleed Eissa
    wrote on last edited by
    #1

    I'm creating a website where users can send mail messages to each other through the website (they don't see the email address of the receiver) From the documentation of the SmtpClient class: If there is an e-mail transmission in progress and you call SendAsync or Send again, you will receive an InvalidOperationException. That doesn't sound very good :( I assume that I have to create a queue class for sending messages because users can be sending messages at the same time (which means many threads calling SmtpClient.Send() at the same time), is this correct? I have another issue too, I noticed that when I send mail from my local machine, some messages are delivered but the majority are not, and even those messages that were successfully delivered, many of them took way too long to be delivered, up to many days with some of them!! I know that there must be something wrong, but I have no idea what, I have checked everything on my computer but everything seemed ok (I checked the SMTP settings, esp. the relay settings, and they were OK. I also checked the settings of the anti-virus software and found it wasn't blocking the outbound SMTP messages), I'm worried it might cause problems later on the production server. Is there any way to get notified of the delivery of messages, I save the messages to a database when the user clicks the Send button, now I want a reliable way of knowing whether the message was delivered or not (I have a field in the database that I use as a flag, I want to set it to true when the message is sent so that I can know what was sent and what wasn't in order to try to send it again), can this be done with the mail classes in the .net framework or do I need some component that's more reliable? If so, do you have any suggestions for a good component? (preferably something you have personal experience with). Sorry for my long post, but I want to mention one last thing. As far as I understand, and please correct me if I'm wrong, SmtpClient.Send() only delivers the messages to the SMTP server and that's it, so if the messages are delivered to the SMTP server and not sent after that there's no way to find out, is this correct? Thank you for taking the time to read my post, any suggestions are very much appreciated ..

    Waleed Eissa Software Developer Sydney

    W 1 Reply Last reply
    0
    • W Waleed Eissa

      I'm creating a website where users can send mail messages to each other through the website (they don't see the email address of the receiver) From the documentation of the SmtpClient class: If there is an e-mail transmission in progress and you call SendAsync or Send again, you will receive an InvalidOperationException. That doesn't sound very good :( I assume that I have to create a queue class for sending messages because users can be sending messages at the same time (which means many threads calling SmtpClient.Send() at the same time), is this correct? I have another issue too, I noticed that when I send mail from my local machine, some messages are delivered but the majority are not, and even those messages that were successfully delivered, many of them took way too long to be delivered, up to many days with some of them!! I know that there must be something wrong, but I have no idea what, I have checked everything on my computer but everything seemed ok (I checked the SMTP settings, esp. the relay settings, and they were OK. I also checked the settings of the anti-virus software and found it wasn't blocking the outbound SMTP messages), I'm worried it might cause problems later on the production server. Is there any way to get notified of the delivery of messages, I save the messages to a database when the user clicks the Send button, now I want a reliable way of knowing whether the message was delivered or not (I have a field in the database that I use as a flag, I want to set it to true when the message is sent so that I can know what was sent and what wasn't in order to try to send it again), can this be done with the mail classes in the .net framework or do I need some component that's more reliable? If so, do you have any suggestions for a good component? (preferably something you have personal experience with). Sorry for my long post, but I want to mention one last thing. As far as I understand, and please correct me if I'm wrong, SmtpClient.Send() only delivers the messages to the SMTP server and that's it, so if the messages are delivered to the SMTP server and not sent after that there's no way to find out, is this correct? Thank you for taking the time to read my post, any suggestions are very much appreciated ..

      Waleed Eissa Software Developer Sydney

      W Offline
      W Offline
      Waleed Eissa
      wrote on last edited by
      #2

      Oh, by the way, I'm aware of DeliveryNotificationOptions but it's not what I'm looking for, I want to get a notification (not an email) that I can use to update the flag in my database. Well, it seems that it's not possible but would anybody confirm that? Thanks.

      Waleed Eissa Software Developer Sydney

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups