sending mail to multiple users

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinod allapu
    New Member
    • Apr 2009
    • 28

    sending mail to multiple users

    hi all,

    I have a string str which contains email addresses seperated with ';' like vinodkumar.alla pu@gmail.com;vi no...@hotma il.com to whom i want to send mails with same body... when iam saying

    mail.To.Add(str );

    its displaying a message saying: The specified string is not in the form required for an e-mail address... can any one solve my problem by changing the code where iam going wrong....!!

    thank you
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    you have to add individual addresses, not a gang of them. Just because outlook seperates with a semicolon doesn't mean .NET does.

    Break down your big string by seperating at the semicolons and add each address one at a time.

    Comment

    • daonho
      New Member
      • Apr 2008
      • 18

      #3
      Split the the email list into array

      Usually when I encounter problem like this, I split the list of email in array and add them individually.

      dim arrEmails as string() = strEmailList.sp lit(";")

      Dim str as string = ""

      foreach str in arrEmails
      mail.to.add(str .trim())

      next

      Don't know why you add to the To field, but you can do mail.CC.add(... ) or mail.BCC.add(.. ...)

      Comment

      • Srikanth Chippa
        New Member
        • May 2009
        • 4

        #4
        You have separate the individual mail id from that string and then add it to
        mail.to.add()
        _______________ ___
        <removed advertising links>
        Last edited by Frinavale; May 20 '09, 03:52 PM. Reason: removed advertising links

        Comment

        • vinod allapu
          New Member
          • Apr 2009
          • 28

          #5
          hi all,

          My problem is solved thanks for ur reply...The information provide by you is usefull to me.... Thanks a Lot

          Comment

          Working...