I've searched and found the following code on this forum to send a
single email to a list of people that is contained in a table. The
table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select CustEMail from CustTable"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
If Not IsNull(rs!CustEmail) Then
'build up email addresses separated by a semicolon
emailTo = emailTo & rs!CustEmail & "; "
End If
rs.MoveNext
Loop
DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message
recipient(s); the message was not sent. Is there some obvious reason
that this code is failing? Any help is appreciated. 8 4007
On Jan 15, 10:43 pm, Wayne <cqdigi...@volcanomail.comwrote:
I've searched and found the following code on this forum to send a
single email to a list of people that is contained in a table. The
table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select CustEMail from CustTable"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
If Not IsNull(rs!CustEmail) Then
'build up email addresses separated by a semicolon
emailTo = emailTo & rs!CustEmail & "; "
End If
rs.MoveNext
Loop
DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message
recipient(s); the message was not sent. Is there some obvious reason
that this code is failing? Any help is appreciated.
Error 2295 is a special number that means that God is unwilling to
allow messages sent with such supremely ugly code through the ether.
"Wayne" <cq*******@volcanomail.comwrote in message
news:1b**********************************@t1g2000p ra.googlegroups.com...
I've searched and found the following code on this forum to send a
single email to a list of people that is contained in a table. The
table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select CustEMail from CustTable"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
If Not IsNull(rs!CustEmail) Then
'build up email addresses separated by a semicolon
emailTo = emailTo & rs!CustEmail & "; "
End If
rs.MoveNext
Loop
DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message
recipient(s); the message was not sent. Is there some obvious reason
that this code is failing? Any help is appreciated.
I think you need to remove the trailing semicolon from emailTo after your
loop terminates:
....
Loop
emailTo = Left(emailTo, Len(emailTo) - 1)
DoCmd.SendObject acSendNoObject, , , emailTo
Actually, it's -2 in this case (Space and Semicolon), being:
emailTo = Left(emailTo, Len(emailTo) - 2)
"Stuart McCall" <sm*****@myunrealbox.comwrote in message
news:fm*******************@news.demon.co.uk...
"Wayne" <cq*******@volcanomail.comwrote in message
news:1b**********************************@t1g2000p ra.googlegroups.com...
>I've searched and found the following code on this forum to send a single email to a list of people that is contained in a table. The table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String Set db = CurrentDb() emailTo = "" sql = "select CustEMail from CustTable" Set rs = db.OpenRecordset(sql) Do Until rs.EOF If Not IsNull(rs!CustEmail) Then 'build up email addresses separated by a semicolon emailTo = emailTo & rs!CustEmail & "; " End If rs.MoveNext Loop DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message recipient(s); the message was not sent. Is there some obvious reason that this code is failing? Any help is appreciated.
I think you need to remove the trailing semicolon from emailTo after your
loop terminates:
...
Loop
emailTo = Left(emailTo, Len(emailTo) - 1)
DoCmd.SendObject acSendNoObject, , , emailTo
"Dominic Vella" <do***********@optusnet.com.auwrote in message
news:47***********************@news.optusnet.com.a u...
Actually, it's -2 in this case (Space and Semicolon), being:
emailTo = Left(emailTo, Len(emailTo) - 2)
"Stuart McCall" <sm*****@myunrealbox.comwrote in message
news:fm*******************@news.demon.co.uk...
>"Wayne" <cq*******@volcanomail.comwrote in message news:1b**********************************@t1g2000 pra.googlegroups.com...
>>I've searched and found the following code on this forum to send a single email to a list of people that is contained in a table. The table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String Set db = CurrentDb() emailTo = "" sql = "select CustEMail from CustTable" Set rs = db.OpenRecordset(sql) Do Until rs.EOF If Not IsNull(rs!CustEmail) Then 'build up email addresses separated by a semicolon emailTo = emailTo & rs!CustEmail & "; " End If rs.MoveNext Loop DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message recipient(s); the message was not sent. Is there some obvious reason that this code is failing? Any help is appreciated.
I think you need to remove the trailing semicolon from emailTo after your loop terminates:
... Loop emailTo = Left(emailTo, Len(emailTo) - 1) DoCmd.SendObject acSendNoObject, , , emailTo
Well spotted! Thanks.
"Wayne" <cq*******@volcanomail.comwrote in message
news:1b**********************************@t1g2000p ra.googlegroups.com...
I've searched and found the following code on this forum to send a
single email to a list of people that is contained in a table. The
table is "CustTable" and the list field is "CustEmail":
Dim db As Database, rs As Recordset, sql As String, emailTo As String
Set db = CurrentDb()
emailTo = ""
sql = "select CustEMail from CustTable"
Set rs = db.OpenRecordset(sql)
Do Until rs.EOF
If Not IsNull(rs!CustEmail) Then
'build up email addresses separated by a semicolon
emailTo = emailTo & rs!CustEmail & "; "
End If
rs.MoveNext
Loop
DoCmd.SendObject acSendNoObject, , , emailTo
When I run the code I get a runtime error 2295: Unknown message
recipient(s); the message was not sent. Is there some obvious reason
that this code is failing? Any help is appreciated.
1. Your email has no subject nor message. Possibly your email system is
balking at this.
2. Try checking the actual value for emailTo (Debug.Print). You might have a
record in your query that is not null but has a zero-length string, or
bizarre characters, or ???
3. You might need a rs.MoveFirst before your loop begins
Fred Zuckerman
Thanks Stuart and Dominic. It works well.
"Wayne" <cq*******@volcanomail.comwrote in message
news:2f**********************************@i29g2000 prf.googlegroups.com...
Thanks Stuart and Dominic. It works well.
Glad that fixed it. Now I can show you a much cleaner, more efficient way to
build your recipient string:
sql = "select CustEMail from CustTable"
emailTo = CurrentProject.Connection.Execute(sql).GetString(2 , , ";")
DoCmd.SendObject acSendNoObject, , , emailTo
That replaces your loop with a one-liner, making use of Access' built-in ADO
Connection object. The literal number 2 is the value of the constant
adClipString, which, if you want to use it, requires a reference to ADO be
set, however, using the literal it works without a reference.
This technique was demonstrated recently by Lyle Fairfield. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gerhard Häring |
last post by:
On my mailserver (running a recent Postfix snapshot) I get this since a
few hours:
mylene:/var# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
DA10713E37 1617 Wed...
|
by: Eduardo Rosa |
last post by:
Somebody knows how I queue email using .Net?
thanks a lot
|
by: Anuradha |
last post by:
Dear All
How can i send mails using vb.net
Thanx all
|
by: Kun |
last post by:
i have the following code:
----------------------------------
import smtplib
from email.MIMEText import MIMEText
fp = open('confirmation.txt', 'rb')
msg = MIMEText(fp.read())
From =...
|
by: 3KWA |
last post by:
Hi all,
I tried to send a small mailing list using python today (2036 emails).
For that purpose I looked in the doc for some code examples (I had
never done it before). And I ended up writing...
|
by: mc |
last post by:
I would like to be able to send, from an ASP.NET page, an email which when recieved takes the form
of a TO-DO list item.
Can this functionality be emulated from sending an email from C#?
I've...
|
by: =?Utf-8?B?QWRl?= |
last post by:
HI All,
I am encountering the following error when I try to send an email through a
SMTP server. I believe the problem lies with the authentication part when the
network crednetials are used,...
|
by: bleachie |
last post by:
Hey,
I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms.
i use this function to add more guestnames and guestemail fields based on the number of...
|
by: Mel via AccessMonster.com |
last post by:
I have four people on my email list. I want to send one email each of the
four people with a list of accounts over due, embodied within the email. So,
for instance, jeff will be sent an email...
|
by: Keith G Hicks |
last post by:
I'm using the following code to send out email messages to a list of people
in a database. My problem is that if I'm sending to 100 people and the 40th
address is bad, it crashes on that one and...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |