Results 1 to 3 of 3

Thread: Automaticly Email from hard disk

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Location
    Bangladesh
    Posts
    106

    Question Automaticly Email from hard disk

    Hi,
    I want to know that "If I want to make such a project which can automaticly email a file from specific path from hard disk to a email address" Could you please help me?

    Thanking you
    Rummy

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    "email a file from specific path from hard disk to a email address"

    yes - you can create an e-mail with an attachment and send it to an address..

    "automaticly"

    no - nothing is automatic in programming, you will need to write code to 'watch' the file and send the e-mail when it changes.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Does the file exist:
    VB Code:
    1. Function FileExist(ByVal strPath As String) As Boolean
    2.     FileExist = Len(Dir$(strPath)) <> 0
    3. end Function
    E-mail using Outlook:
    VB Code:
    1. 'Reference Microsoft Outlook 9.0 Object Library (msoutl9.olb)
    2. Private Sub Email_Click()
    3.         Dim olapp As New Outlook.Application
    4.         Dim olMail As Outlook.MailItem
    5.         Dim myAttachment As Outlook.Attachments
    6.         'Create a new mail object
    7.         Set olMail = olapp.CreateItem(olMailItem)
    8.         Set myAttachment = olMail.Attachments    
    9.         myAttachment.Add "C:\text.txt"
    10.         olMail.Subject = “Testing a send of a message”
    11.         olMail.Body = "Hello, this is the body"
    12.         olMail.Recipients.Add "[email protected]"
    13.         olMailsend
    14.  
    15.         Set olMail = Nothing
    16.         Set olapp = Nothing
    17. End Sub
    But if you don't have Outlook, you might need to use something else, like MAPI:
    VB Code:
    1. 'need a MAPI control on the form somewhere
    2.         MAPISession1.SignOn
    3.         MAPIMessages1.SessionID = MAPISession1.SessionID
    4.         frmMonitor.MAPIMessages1.Compose
    5.         frmMonitor.MAPIMessages1.RecipDisplayName = "[email protected]"
    6.         frmMonitor.MAPIMessages1.MsgSubject = "My Subject"
    7.         frmMonitor.MAPIMessages1.MsgNoteText = "My body"
    8.         frmMonitor.MAPIMessages1.AttachmentPathName = sAttachment1
    9.         frmMonitor.MAPIMessages1.ResolveName
    10.         frmMonitor.MAPIMessages1.Send        
    11.         frmMonitor.MAPISession1.SignOff

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