Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple and automatic email sending

Status
Not open for further replies.

Davide77

Technical User
Mar 6, 2003
166
CH
hallo,
i have a query with these fields: "subject", "cc", "Message", "Address".

I'm trying to make access send automatically one email to each recipient (record) just by clicking a button. The emails should be generated by using the information stored in the query.

programmer Luceze gave me this code:

Dim rs As DAO.Recordset
Dim qd As DAO.QueryDef
Set qd = CurrentDb.QueryDefs("YourQueryName")
Set rs = qd.OpenRecordset
Do until rs.EOF
DoCmd.SendObject , , , rs!Address, , RS!Subject, RS!Message
RS.MoveNext
Loop

It actually work almost completely. But I realised that it cut the message after 251 characters. A second problem of this code is that it always requests a confirmation for each email. It's ok when emails are 20, but when are 200....

Does someone has an idea to solve this? thanks
 
Hi Davide77,

I am not sure about the 251 character problem. I assume you must be using a Memo field in your table. If you arent and you are using a Text field, then there is a character limitation of <255. I have tried using your code with a Memo field and havent been able to re-create your problem.

On to the email question...

There really isnt an easy way to get around the email confirmation if you are sending one email at a time. This is part of MS security and frankly, a pain in the butt. (THANKS SPAMMERS!!!)

If each email is unique to the intended receiver, you have a problem. If the email is generic, you could string the email addresses together and place them in the BCC field (so everyone doesnt see each others email address, not required just a thought). Then, you could send just 1 email to everyone.

MS information on email security:


Sorry I couldnt provide a perfect solution but I hope I have been of help.



Have A Great Day!!!, [bigglasses]

Nathan
Senior Test Lead
 
I am also trying to email a message created in a memo field, and am also cut off at 251 charaters. This must be some kind of limit somewhere.

I am also attaching a snapshot whit this email...


Access 2003, Windows XP with Outlook Express.
 
Well I figured out a work around......

Here is the code I use on the form.

Private Sub SendEmailButton_Click()
Dim rs As DAO.Recordset
Dim strSQL As String

strSQL = "SELECT * FROM emailquery WHERE contact = -1"
Set rs = CurrentDb.OpenRecordset(strSQL)

With rs

Do While Not rs.EOF
Me.email1 = ![Email Address]
If ![Email Address] <> "" Then DoCmd.SendObject acSendReport, "WCRC Letter", acFormatSNP, ![Email Address], , , !eSubject, Me.eMessage, False

.MoveNext
Loop
End With
End Sub



I changed the !eMessage to me.eMessage above. This refers to the memo in the form I am using.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top