Creating a mailing application, need some help and suggestions please....

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

I am creating an application (lack of a better term, similair to an auto
responder, but just as far as the "ADD ME and REMOVE ME are concerned... It
is a Prayer List for may church) I want to basically have it so that it will
be have as follows:

First, if some body sends me a request for a prayer, I will enter this into
excel, and will have the following columns:
Name, Type of Prayer, Details, and Parish

I will then create an email with the following code: I am not sure how to
use a DIST LIST in the TO, and how to format part of the body (where I am
pasting in the excel data (see comments in code)

Sub CreateMail()

Dim ol As Outlook.Application

Dim mi As MailItem

Dim MyHtm As String

Dim AutoSig As String

Dim TheSig As String



TheSig = "Please have the following in your heart and prayers:"& vbCrLf



Set ol = New Outlook.Application

Set mi = ol.CreateItem(olMailItem)

mi.Display



TheSig = theSig & ActiveCell.Offset(0, 1).Value & "," &
ActiveCell.Offset(0, 2).Value & _

"," & ActiveCell.Offset(0, 3).Value & "," & ActiveCell.Offset(0, 4).Value

' instead of comma, I would like to have a actual tab. I have tried the
vbtab, but that just does not do what I want. (or maybe I can insert a
"table" and stuff them with the info from the cells?)



mi.To = ?????? This would be a DIST list, I am NOT sure how to do this..

mi. Body = thesig

mi.ReadReceiptRequested = True

mi.OriginatorDeliveryReportRequested = True



mi.Subject = "Please pray for the enclosed"



End Sub



I also want to have the "Remove Me" and "Add Me" to automatically remove or
add the person to the dist list (I would LIKE to do a double opt in, but I
have NO idea on how to get THAT sofisicated!)



For the REMOVE ME, I would have a RULE, that , if the SUBJECT is REMOVE ME
and through the given account, a SCRIPT would be ran, and then the email
address would be passed to the following code ( used the example from the
HELP and modified it, do I need to .add in order to remove?) (What kind of
error checking should be put in place?):

function RemoveRequest(mi as mailitem) Dim olApp As Outlook.Application
Dim objDstList As DistListItem Dim objName As NameSpace Dim objSender
As SenderName Dim objMail As MailItem Set olApp = Outlook.Application
Set objName = olApp.GetNamespace("MAPI") Set objDstList =
objName.GetDefaultFolder(olFolderContacts).Items("PrayerList") Set
objMail = olApp.CreateItem(olMailItem) Set objSender =
objMail.senderName.Add(Name:= objSender) ' is this correct? Is this
required? objDstList.RemoveMember SenderName:=objSender End Sub

The ADD ME should be basically the same, I think....



Thanks!

Bruce
 
Forget distribution lists. They are much more trouble than they're worth for
this application. You'd be much better off maintaining the members of the
prayer lists as individual items in a separate contacts folder. Your rule
script can create a new ContactItem using the sender's address. While there
is no Outlook property that returns the sender's email address, you can
either use CDO (or Redemption to avoid security prompts --
http://www.dimastr.com/redemption/) to get the From address or use Outlook
(or Redemption) to get the Reply To address. Sample code at
http://www.slipstick.com/dev/code/getsenderaddy.htm.

You didn't explain in what way vbTab didn't do what you wanted. An HTML
table probably would be nicer. See
http://www.outlookcode.com/codedetail.aspx?id=249 for an example.

In any case, if you're going to work with address information, you're going
to need to use Redemption if you want to avoid security prompts. See
http://www.dimastr.com/redemption.

If you get really ambitious, you could maintain the prayer requests
themselves in Outlook, perhaps as custom post, journal or task items.
 
Back
Top