Results 1 to 7 of 7

Thread: Send Email to Internet Users

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Question Send Email to Internet Users

    My VB.NET Application needs to send email periodically to internet users .. how to do this? ..

    Thanks a lot in advance

    Regards
    Winanjaya

  2. #2
    Hyperactive Member
    Join Date
    Apr 2003
    Location
    Three Rivers, MI
    Posts
    354
    Here is a sample I cut and pasted from one of my forms. Keep in mind that even though this is a windows form you still use the systems.web.mail to fire off the email.
    VB Code:
    1. Dim newMail As New System.Web.mail.MailMessage
    2. newMail.To = "[email protected]"
    3. newMail.From = "[email protected]"
    4. newMail.Body = _
    5.     "This is a test email message from the new time " & _
    6.     "entry application. This function will be used in " & _
    7.     "the new T.E. App to announce when a payroll period " & _
    8.     "begins and ends." & vbCr & vbCr & "This announcement " & _
    9.     "is an automated message so please do not reply to it.  " & _
    10.     "You can just ignore this message for now." & vbCr & vbCr & _
    11.     "Thank You," & vbCr & vbCr & "Signature Here"
    12. newMail.Subject = "Start Payroll <---- Just ignore for now"
    13.  
    14. System.Web.Mail.SmtpMail.SmtpServer = "MailServerName"
    15. System.Web.Mail.SmtpMail.Send(newMail)

    Just change the To, the From and the mail server name to match your needs.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784
    Thanks but When I try to send though the local SMTP service on Win 2000 AS I get "Error!! Could not access 'CD).Message' object"

    am I missing something?

    TIA

    Winanjaya

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Lets see the code you are using. There are limitations to using this method. First, IIS has to be installed. That is probably where you are getting an error.

    The way I got around that when I was creating a project recently was to put the email functionality in a web service. The client app calls the web service passing in all the information, and the web service does the emailing. Something to look into if you are operating in a networked environment.

  5. #5
    Lively Member
    Join Date
    Jul 2003
    Posts
    93
    hellswraith,

    I'm trying to do the same thing & receive the error message:
    Could not access 'CDO.Message' object. I've added a reference to system.web & system.web.services to my project. I have IIS installed. The code I am runnign is exactally what Bukhix had posted before (with my server name changed along with the To & From addresses. I am on a networked environment and need to send these emails to outside customers. Thanks for any help you can offer.

    Corinne

  6. #6
    Hyperactive Member
    Join Date
    Apr 2003
    Location
    Three Rivers, MI
    Posts
    354
    Since you are on a local network and trying to send emails to outside domains you may be experiencing a problem with authentication.

    You may want to check this thread for a possible solution:

    Please help SMTP server authentication

    Let me know if that takes care of the problem.

  7. #7
    Addicted Member
    Join Date
    May 2001
    Posts
    153

    smtp problem

    Hi Bukhix,

    I am referencing System.Web.Mail in my C#.net application
    but there is a problem. It says

    D:\Projects\Mailing\frmSendMail.cs(9): The type or namespace name 'Mail' does not exist in the class or amespace 'System.Web' (are you missing an assembly reference?)

    Do I need to include anyother namespace?

    What file (*.dll) should I reference in my project so that
    the namespace is recognised?

    thanks
    there r no alternatives 4 hardwork.

Posting Permissions

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



Click Here to Expand Forum to Full Width