Sending Email Via Modules

PAMPEREDBECCA

New member
Local time
Today, 02:09
Joined
Aug 6, 2000
Messages
9
I am trying to send a global e-mail via a module. I can get it to send with a Loop, however I have an attachment that I want to send to my entire e-mail listing (of members, this is NOT spam! I just don't want the rest of the folks to have to scroll through a bunch of e-mail addresses). If I send via a loop I have to attach the attachment each and everytime. Does anyone know how to write this where it will pull all e-mail addresses into one e-mail? Thanks in advance! Becca
 
Becca -

At this web site ftp://216.122.12.123/pub/candace/candace.html you will find an Email demo database by Candace Tripp. She just added this to her site and I have only glanced at it, but maybe you can glean some useful information from her demo.

HTH,
Jack

[This message has been edited by Jack Cowley (edited 08-10-2000).]
 
Are you adding the attachment manually?, and if so, is this because it's something that is outside your access application?

You might be able to do this by setting the recipient as yourself, and putting your list of real recipients in the BCC address, although when people receive it, they will only see your email address in the 'To' field.

Not sure how your email app or server works, but if you're using something like MDaemon, you could set up a mailing list on that, send the mail once to the list and let the server distribute it. Some email apps also have some kind of list functionality.

Hope this is of some help.
 
I am adding the attachment manually because it is outside of my database.

I actually am using blind copy in the code. Below is the line

DoCmd.SendObject acSendNoObject, , , RstTmp.Fields![emailaddress].Value, , , , , True

This line sends each email address a message separately, what I want to do is include them all in the same e-mail message. I was thinking that I should be able to replace .Value with something else to make this happen but I haven't been able to figure it out. If you have any suggestions I would be grateful! Thanks in advance!

Becca
 
I thought I had this cracked; I was hoping that you coulde set up a template (*.oft) with the attachment already inserted and use that, but it doesn't seem to work.

if you want to send all of your emails together as one message, you need to put the SendObject just after your loop, and within the loop, you just add all of the recipient's addresses together into a long string, something like:

dim BigAddressList as string '(NB this needs to be at the start of the event sub)
for loop1 = 1 to RstTmp.recordcount
BigAddressList = BigAddressList & RstTmp.Fields![emailaddress].Value & "; "
rstTmp.movenext
next loop1
DoCmd.SendObject acSendNoObject, , , BigAddressList , , , , , True

If you're putting the big list in the BCC then the recipients won't see it.

Is this any help?

Is your attachment something of the type that could not be imported and sent as a table/report??

Mike

[This message has been edited by Mike Gurman (edited 08-14-2000).]

[This message has been edited by Mike Gurman (edited 08-14-2000).]
 
Mike,

It looks like this should work, however, do you know if I should have to enter all of the addresses into my Outlook Express address book or if I can just keep them in Access. I am getting a runtime error when I execute indicating Unknown Recipient. Thanks for all of your help so far!
 
My last message is actually incorrect. I tested my theory with some members of my current address book and it is giving me the same error. I am going to keep trying and I'll let you know what I discover.
 
You shouldn't have to enter the recipients into Outlook for it to work, it might be that adding the spare semicolon on the end of the list is fouling it up somehow, you could either chop it off (insert either of these options after the NEXT statement):

BigAddressList = mid(BigAddressList,1,(len(BigAddressList)-2)

or stick your own email address on the end so you get a copy of the email for yourself:

BigAddressList = BigAddressList & "pamperedbecca@cs.com"

if this doesn't work, try inserting a breakpoint after the NEXT statament and set up a watch on 'BigAddressList' - you'll then be able to see if there's anything strange about the address string.

It could also be that something is wrong with one or more of the email addresses in your database (like if it's got two @ symbols or some other dodgy stuff).

Mike



[This message has been edited by Mike Gurman (edited 08-14-2000).]
 
Mike,

While you were working on this, I decided to mess around with it a little. I took out the space after the semicolon in your SendObject line. Guess what! It worked! I have no idea how, but I'm not complaining! Thank you so much for all of your help! I appreciate it!

Becca
 
You're quite right you know.

That's what happens when I try to write code from memory.

It's interesting though, that if you enter spaces in the list when manually creating an email in Outlook, it doesn't mind.

Anyway, glad you got it sorted in the end

Mike
 

Users who are viewing this thread

Back
Top Bottom