Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Visual Basic ( VB ) (http://www.go4expert.com/forums/visual-basic/)
-   -   help with mail sending using outlook (http://www.go4expert.com/forums/help-mail-sending-using-outlook-t10861/)

TOC666 28May2008 10:35

help with mail sending using outlook
 
hey everyone
i'm using this code to send mail via outlook

Code:

Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
 
  'Create an Outlook object
  Dim Outlook 'As New Outlook.Application
  Set Outlook = CreateObject("Outlook.Application")
 
  'Create e new message
  Dim Message 'As Outlook.MailItem
  Set Message = Outlook.CreateItem(olMailItem)
  With Message
    'You can display the message To debug And see state
    '.Display
   
    .Subject = Subject
    .HTMLBody = TextBody
   
    'Set destination email address
    .Recipients.Add (aTo)
    If Len(aFrom) > 0 Then .SentOnBehalfOfName = aFrom
   
    'Set sender address If specified.
    Const olOriginator = 0
    'If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
   
    'Send the message
    .Send
  End With
End Sub

i'm sending mail using active directory the problam is when i send using an inputbox and there are two names in the active directory, i get an error...

is there any way to check if there are two names in the active directory before sending and letting the user select the person he ment to send it?

thanks for ur help


All times are GMT +5.5. The time now is 17:10.