|
-
Jul 9th, 2007, 11:47 PM
#1
Thread Starter
Fanatic Member
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.
-
Jul 10th, 2007, 07:49 AM
#2
Re: sending mail (Ms outlook)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|