On 9/24/03 there was a request for email using Notes. Since I use Outlook, I thought I would try that instead, here is my Sensible Solution:

VBSTART
Sub SendOutlookMail
Set objOutlook = CreateObject("Outlook.Application")
Set objMailItem = objOutlook.CreateItem(0)
' // Option Values for Outlook Object CreateItem( ) are:
' // 0=MailItem, 1=AppointmentItem, 2=ContactItem, 3=TaskItem
' // 4=JournalItem, 5=NoteItem, 6=PostItem
objMailItem.To = "[email protected]" ' This is the primary recipient
objMailItem.Subject = "Test Macro Scheduler VB Outlook email" ' This is the Subject
objMailItem.Body = "This was sent using Macro Scheduler code." & Chr(13) & Chr(13) & "This is an example of a second line, double spaced." ' This is the Email message
' // Following items are optional settings that can be used =====================
objMailItem.Recipients.Add "[email protected]" ' Append a 2nd Email recipient
objMailItem.Recipients.Add "[email protected];[email protected]" ' Append additional Email recipient ;(s);
objMailItem.CC = "[email protected];[email protected]" ' Carbon Copy name ;(s);
objMailItem.BCC = "[email protected];[email protected]" ' Blind Carbon Copy Name ;(s);
objMailItem.FlagStatus = 2 '0=None (Default), 2=Marked (Red) NOTE:1=Complete (White) cannot be used on unsent email,
objMailItem.Importance = 2 '0=Low (Blue), 1=Normal (None)(Default) 2=High (Red)
' // objAttachments.Add "Source", [Type], [Position], ["Display Name to replace default file name"]
objMailItem.Attachments.Add "C:\config.sys",olByValue, 1, "Test attached config.sys"
' // End of optional items ============================
Set objMailer = objOutlook.GetNameSpace("MAPI")
objMailer.Logon "Actual Profile Name", "Actual Password" 'Logon to Mailer
objMailItem.Send ' send method
' // Use Save method vs. Send to put email in Drafts Folder vs. Outbox/Sending
' // objMailItem.Save ' save method
objMailer.Logoff ' Logoff from Mailer
End Sub
'=======================================
VBEND
VBRun>SendOutlookMail
Label>End

This routine will send the email immediately and leave a copy in the Sent Items or move the Email to the Outbox folder, depending on your settings.


This should provide you with a working model showing syntax, punctuation, etc.

