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
Printable View
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
"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.
Does the file exist:
E-mail using Outlook:VB Code:
Function FileExist(ByVal strPath As String) As Boolean FileExist = Len(Dir$(strPath)) <> 0 end Function
But if you don't have Outlook, you might need to use something else, like MAPI:VB Code:
'Reference Microsoft Outlook 9.0 Object Library (msoutl9.olb) Private Sub Email_Click() Dim olapp As New Outlook.Application Dim olMail As Outlook.MailItem Dim myAttachment As Outlook.Attachments 'Create a new mail object Set olMail = olapp.CreateItem(olMailItem) Set myAttachment = olMail.Attachments myAttachment.Add "C:\text.txt" olMail.Subject = “Testing a send of a message” olMail.Body = "Hello, this is the body" olMail.Recipients.Add "[email protected]" olMailsend Set olMail = Nothing Set olapp = Nothing End Sub
VB Code:
'need a MAPI control on the form somewhere MAPISession1.SignOn MAPIMessages1.SessionID = MAPISession1.SessionID frmMonitor.MAPIMessages1.Compose frmMonitor.MAPIMessages1.RecipDisplayName = "[email protected]" frmMonitor.MAPIMessages1.MsgSubject = "My Subject" frmMonitor.MAPIMessages1.MsgNoteText = "My body" frmMonitor.MAPIMessages1.AttachmentPathName = sAttachment1 frmMonitor.MAPIMessages1.ResolveName frmMonitor.MAPIMessages1.Send frmMonitor.MAPISession1.SignOff