locked
CDO for Exchange Server 2000 RRS feed

Answers

  • Hi GrayscaleRu,

    Welcome to MSDN forums!

    Please check firstly whether your Exchange Server uses SMTP Server internally to send mails. If yes, here is code sample:

    Imports System.Web.Mail  
     
    Public Class Class1  
     
        Public Sub Mailer()  
     
            Dim mailMessage As MailMessage = New MailMessage()  
            mailMessage.To = "Mention Mail Address" '(semi-colon separated list for multiple addresses)  
            mailMessage.From = "Mention Mail Address" 
            mailMessage.Subject = "ldjlsjf" 
            mailMessage.Body = "lkjdflj" 
     
            Dim attachment As MailAttachment = New MailAttachment("C:\megacd.log"'create the attachment  
            mailMessage.Attachments.Add(attachment) 'add the attachment  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1"'basic authentication  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername""NTLogin"'set your username here  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""Password"'set your password here  
     
            SmtpMail.SmtpServer = "smtpHostAdress" '(Mention the ip address of Exchange Server)
            SmtpMail.Send(mailMessage)  
     
        End Sub 
     
    End Class 

    Emails send Through Exchange Server
    http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/d5b418a1-69f5-4899-8904-8f8f72905392/
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2568741&SiteID=1
    System.Web.Mail Namespace
    http://msdn.microsoft.com/en-us/library/system.web.mail.aspx


    Using System.Net.Mail namespace instead of System.Web.Mail.

    Imports System.Net.Mail     
        
    Public Class Form1     
        
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click     
            Dim mailInstance As MailMessage = New MailMessage("FromMailAdress""ToMailAdress""Subject""Body")     
            mailInstance.Attachments.Add(New Attachment("filename")) 'Optional     
            Dim mailSenderInstance As SmtpClient = New SmtpClient("smtpHostAdress", 25) '25 is the port of the SMTP host     
            mailSenderInstance.Credentials = New System.Net.NetworkCredential("LoginAccout""Password")     
            mailSenderInstance.Send(mailInstance)     
            mailInstance.Dispose()     
        End Sub    
        
    End Class    
     

    Trackback: Several approaches to send email in VB.NET
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2417150&SiteID=1

    About CDO component in .NET
    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/08282142-b45e-4df5-8d18-de31e0682b35



    Related forums:
    Forums Home > Open Specifications > Using the Exchange Server Protocols

    ASP.NET Forums » Windows Hosting » Microsoft Solution for Hosted Exchange


    Best regards,
    Martin Xie

    Tuesday, October 21, 2008 8:29 AM

All replies

  • May be some body knows how can i send mail through ms exchange automatically without mail clients installed?
    Thursday, October 16, 2008 5:28 AM
  • Hi GrayscaleRu,

    Welcome to MSDN forums!

    Please check firstly whether your Exchange Server uses SMTP Server internally to send mails. If yes, here is code sample:

    Imports System.Web.Mail  
     
    Public Class Class1  
     
        Public Sub Mailer()  
     
            Dim mailMessage As MailMessage = New MailMessage()  
            mailMessage.To = "Mention Mail Address" '(semi-colon separated list for multiple addresses)  
            mailMessage.From = "Mention Mail Address" 
            mailMessage.Subject = "ldjlsjf" 
            mailMessage.Body = "lkjdflj" 
     
            Dim attachment As MailAttachment = New MailAttachment("C:\megacd.log"'create the attachment  
            mailMessage.Attachments.Add(attachment) 'add the attachment  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1"'basic authentication  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername""NTLogin"'set your username here  
            mailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""Password"'set your password here  
     
            SmtpMail.SmtpServer = "smtpHostAdress" '(Mention the ip address of Exchange Server)
            SmtpMail.Send(mailMessage)  
     
        End Sub 
     
    End Class 

    Emails send Through Exchange Server
    http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/d5b418a1-69f5-4899-8904-8f8f72905392/
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2568741&SiteID=1
    System.Web.Mail Namespace
    http://msdn.microsoft.com/en-us/library/system.web.mail.aspx


    Using System.Net.Mail namespace instead of System.Web.Mail.

    Imports System.Net.Mail     
        
    Public Class Form1     
        
        Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click     
            Dim mailInstance As MailMessage = New MailMessage("FromMailAdress""ToMailAdress""Subject""Body")     
            mailInstance.Attachments.Add(New Attachment("filename")) 'Optional     
            Dim mailSenderInstance As SmtpClient = New SmtpClient("smtpHostAdress", 25) '25 is the port of the SMTP host     
            mailSenderInstance.Credentials = New System.Net.NetworkCredential("LoginAccout""Password")     
            mailSenderInstance.Send(mailInstance)     
            mailInstance.Dispose()     
        End Sub    
        
    End Class    
     

    Trackback: Several approaches to send email in VB.NET
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2417150&SiteID=1

    About CDO component in .NET
    http://social.msdn.microsoft.com/forums/en-US/vbgeneral/thread/08282142-b45e-4df5-8d18-de31e0682b35



    Related forums:
    Forums Home > Open Specifications > Using the Exchange Server Protocols

    ASP.NET Forums » Windows Hosting » Microsoft Solution for Hosted Exchange


    Best regards,
    Martin Xie

    Tuesday, October 21, 2008 8:29 AM