-
Jun 24th, 2006, 11:54 PM
#1
Thread Starter
New Member
schedule to send email on a shared network pc
Hi all,
i have tried to do a search on this one but to no avail. pls help me
i am using a shared network pc with ms outlook and exhange server installed. i have an administrator account for this pc.
my question is can i schedule this pc to automatically send an email daily? i would used ms schedule tasks to run a vb app which will do some computation and generate a report by email. can it be done?
-
Jun 24th, 2006, 11:59 PM
#2
Re: schedule to send email on a shared network pc
yes it can be done, your vb app can send the email using mapi.
vb has a mapi control which can be used or
search for mapi and cdo for more information
-
Jun 25th, 2006, 12:03 AM
#3
PowerPoster
Re: schedule to send email on a shared network pc
You dont need outlook to send the email unless you want to ..?
There is CDO then there is Winsock .. CDO is much easier .. Winsock is more dependable and talks back to you ... more complicated though ..
http://www.vbforums.com/showthread.p...61#post2487661
as for schedulinbg i have used Win32_ScheduledJob though i am looking for new ideas as that is basically DOS .. though it does work well so far ..
Rory
-
Jun 25th, 2006, 12:25 AM
#4
Thread Starter
New Member
Re: schedule to send email on a shared network pc
hi guys. thanks for the fast reply.
yup i heard about mapi. i found a section of this code from microsoft.
VB Code:
Private Sub Command1_Click()
Dim objSession As Object
Dim objMessage As Object
Dim objRecipient As Object
'Create the Session Object.
Set objSession = CreateObject("mapi.session")
'Logon using the session object.
'Specify a valid profile name if you want to.
'Avoid the logon dialog box.
objSession.Logon profileName:="MS Exchange Settings"
'Add a new message object to the OutBox.
Set objMessage = objSession.Outbox.Messages.Add
'Set the properties of the message object.
objMessage.subject = "This is a test."
objMessage.Text = "This is the message text."
'Add a recipient object to the objMessage.Recipients collection.
Set objRecipient = objMessage.Recipients.Add
'Set the properties of the recipient object.
objRecipient.Name = "John Doe" '<---Replace this with a valid
'display name or e-mail alias
'Type can be ActMsgTo, mapiTo, or CdoTo for different CDO versions;
'they all have a constant value of 1.
objRecipient.Type = mapiTo
objRecipient.Resolve
'Send the message.
objMessage.Send showDialog:=False
MsgBox "Message sent successfully!"
'Logoff using the session object.
objSession.Logoff
End Sub
the thing that puzzles me is how can i log in using my account, id and pwd to the exchange server. what is the syntax?
-
Jun 25th, 2006, 12:33 AM
#5
PowerPoster
Re: schedule to send email on a shared network pc
did you try my code?
Also, does your SMTP actually require authentication?
-
Jun 25th, 2006, 01:03 AM
#6
Thread Starter
New Member
Re: schedule to send email on a shared network pc
Originally Posted by rory
did you try my code?
Also, does your SMTP actually require authentication?
thanks for your code and help. i think my organisation requires authentication to connect to SMTP server. i am not sure. i will get back to you when i have already try at work
can anyone help me with the mapi session login?
-
Jul 1st, 2006, 03:31 AM
#7
Thread Starter
New Member
Re: schedule to send email on a shared network pc
Originally Posted by rory
did you try my code?
Also, does your SMTP actually require authentication?
hey thanks for the code. it works at my company.
my question is how can you explain the line below? what is the 2? i tried connecting to the link to read more about it but it gives me "page not found". can you give me any link that i can read more about its usage?
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
-
Jul 1st, 2006, 03:45 AM
#8
PowerPoster
Re: schedule to send email on a shared network pc
no prob ..
Indicates how the message is to be sent. Values are:
1 - Send messages by using the locally installed SMTP service. Use this value if the SMTP service is installed on the computer where the script is running.
2 - Send messages by using the SMTP service on the network. Use this value if the SMTP service is not installed on the computer where the script is running.
http://www.microsoft.com/technet/scr....mspx?mfr=true
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
|