Results 1 to 2 of 2

Thread: sending mail (Ms outlook)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    sending mail (Ms outlook)

    hi all,
    Am attending to send a mail to the user if the PST file size crossed 100 mb,
    now i got error in the string user.i stored the user mail id in a string and tried to use it, but am facing some problem
    ERROR i s DOMAIN NAME REQUIRED FOR SENDER ADDRESS..
    Can anybody solve this..





    Code:
    Private Sub Command1_Click()
    
    
    Dim siz As New FileSystemObject
    Dim fil As File
    Dim fldr As Folder
    Dim mb As Long
    Dim user As String
    
    user = Outlook.Session.CurrentUser.Address
    
    Set fil = siz.GetFile("D:\VijayMails\Outlook1.pst")
    
    mb = (fil.Size / 1024) / 1024
    
     
     
     If mb > 100 Then
       Call SendMailUsing("user", "user", "test", "test", "")
       Else
       MsgBox "PST File Size doesn't exceed the range"
     End If
    End Sub
    
    Private Sub Form_Load()
    Command1.Caption = "Click ME "
    End Sub
    Private Sub SendMailUsing(mailto As String, mailfrom As String, mailmessage As String, mailbody As String, mailAttachmentFilename As String)
    Dim objMessage
    
    On Error GoTo err:
        Set objMessage = New CDO.Message
        Dim a As New CDO.Message
        objMessage.Subject = "Test Message"
        objMessage.From = mailfrom  'mail from "[email protected]
        objMessage.To = mailto  'mail to [email protected]
        objMessage.TextBody = mailbody
        objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.1.10"
        objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        objMessage.Configuration.Fields.Update
        'objMessage.AddAttachment mailAttachmentFilename
        objMessage.Send
        Set objMessage = Nothing
        MsgBox "Email Sent!"
         Exit Sub
    
    err:
        MsgBox "Error!" & vbNewLine & err.Description
        Exit Sub
    End Sub
    Last edited by vijy; Jul 9th, 2007 at 11:57 PM.

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