Below is the code I'm trying to use to create a blank email with the bcc list populated from a query.
(1) I have tested the codes output of the " rcpts" field, and counted it as well - OK
(2) I've removed the " rcpts" field from the bcc option of the SendObject tag - OK
(3) I tried inserting the DoCmd.SendObjec t line into the loop and used the .Field("EmailNa me") as bcc - it worked OK
I need a single blank email, with all the rcpts addresses in the bcc field.
The code works great, until I insert the rcpts name in the bcc option. Am I using the wrong syntax to call the rcpts into the SendObject tag? Or is there a limit to the size of the bcc field for the SendObject tag? Please Help!
Thanks - Dim db As DAO.Database
-
Dim rst As DAO.Recordset
-
Dim rcpts As String
-
Dim rcptscount As Integer
-
-
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("EmailInfo")
-
rcpts = ""
-
rcptscount = "0"
-
-
With rst
-
.MoveFirst
-
Do Until .EOF
-
rcpts = rcpts & .Fields("EmailName") & ";"
-
rcptscount = rcptscount + 1
-
.MoveNext
-
Loop
-
End With
-
-
Debug.Print rcpts
-
Debug.Print rcptscount
-
-
DoCmd.SendObject , , , "email@server.com", , rcpts, "Subject Text Here", "Message Text Inserted Right Here - Or Leave Blank", True
-
-
rst.Close
7 9328 Denburt 1,356
Recognized Expert Top Contributor
Look in the immediate window and check this debug statement something must be fishy with you email addresses or something. Maybe you can post it with dummy addresses so we can see what is going on.
...I need a single blank email, with all the rcpts addresses in the bcc field. The code works great, until I insert the rcpts name in the bcc option. Am I using the wrong syntax to call the rcpts into the SendObject tag? Or is there a limit to the size of the bcc field for the SendObject tag?
I'm not aware of any limit, and in fact haven't used the SendObject command. However, while Access does apply string-length limits in macros (I've run into that one) the suggested solution is to use VBA where the limits don't apply.
Could you give us a little more detail on the way in which it isn't working? Are you getting an error? Does it appear to work, but the mail never arrives? Etc.
But as far as the circumstances whichi stop it working - it's simply the use of multiple addresses, is that correct? Have you tried isolating the SendObject without the rest of your code, and just testing different values in Bcc?
Have you tried using your list delimiter (probably a comma) rather than semicolon, as mentioned in the online help for SendObject? Shouldn't be necessary, but may be worth a try.
By the way, I'm going to move this to the Access forum, as we should benefit from the weight of Access experience over there.
I've been playing with the code, and I have it working as far as sending the first 255 characters of the BCC field. Now, I created a form with a MEMO field called BCC, which I have successfully transfered all the email addresses to, except again, they do not transfer to the Outlook Email.
Aaaahhhhh! I'm losing my mind over this. Is there better code than the SendObject, which will avoid the 255 character limitation?
I've been playing with the code, and I have it working as far as sending the first 255 characters of the BCC field. Now, I created a form with a MEMO field called BCC, which I have successfully transfered all the email addresses to, except again, they do not transfer to the Outlook Email.
Aaaahhhhh! I'm losing my mind over this. Is there better code than the SendObject, which will avoid the 255 character limitation?
I don't know, but hopefully someone else here might.
In the meantime, could you work around the problem in some way? For example, could you create a distribution list in Outlook and use that in the Bcc field instead of the individual addresses?
Or send the e-mail as many times as necessary to use up all of the addresses, in chunks of up to 255 characters? This would probably at least be an improvement over one e-mail per address.
Look in the immediate window and check this debug statement something must be fishy with you email addresses or something. Maybe you can post it with dummy addresses so we can see what is going on.
Hai. I need to Send and Receive Email using Ms-Access and OutLook.
Now am using the following code for Send Email. -
Private Sub Command20_Click()
-
-
Dim mess_body As String
-
Dim appOutLook As Outlook.Application
-
Dim MailOutLook As Outlook.MailItem
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
-
Set appOutLook = CreateObject("Outlook.Application")
-
Set MailOutLook = appOutLook.CreateItem(olMailItem)
-
-
With MailOutLook
-
.BodyFormat = olFormatRichText
-
.To = Me.Email_Address
-
-
.CC = Me.Cc_Address
-
.BCC = Me.Bcc_Address
-
-
.Subject = Me.Mess_Subject
-
.HTMLBody = Me.Mess_Text
-
-
If Left(Me.Mail_Attachment_Path, 1) <> "<" Then
-
.Attachments.Add (Me.Mail_Attachment_Path)
-
End If
-
-
.Send
-
-
End With
-
-
Exit Sub
-
-
email_error:
-
MsgBox "An error was encountered." & vbCrLf & "The error message is: " &
-
-
Err.Description
-
Resume Error_out
-
Error_out:
-
-
End Sub
-
This code, the attachment was working as, we type the location of the path manually. I need the Browse button to browse and select the file, the selected file path was stored in a text box.
And Also i need to Receive Email using Ms-Access and OutLook.
Can Anybody know this, please let me know.
Thanks
Tamilvanan
NeoPa 32,564
Recognized Expert Moderator MVP
You didn't post the results of your Debug.Print rcpts. I suspect it was very long, so no problem.
I would guess that it had a trailing ';' character though, which may (or may not) cause a problem. It wouldn't in the Outlook client, but who knows what it may fall over within VBA code.
Otherwise, I'd be very surprised if the length limit to a BCC parameter were as low as 255 chars.
Denburt 1,356
Recognized Expert Top Contributor
I need a single blank email, with all the rcpts addresses in the bcc field.
The code works great, until I insert the rcpts name in the bcc option. Am I using the wrong syntax to call the rcpts into the SendObject tag? Or is there a limit to the size of the bcc field for the SendObject tag? Please Help!
I am curious about why you want a blank email but that is a topic for later discussion. Are you getting any kind of error, if so what does it say? It would be nice to know the error number and description if you are getting one.
I am thinking you are possibly having an issue with one of the addresses. I know that I had a way of verifying email addresses but it is something I can't locate at this time. I just checked the help for sendobject and I noticed the following:
If the mail application can't identify the recipients' names, the message isn't sent and an error occurs.
I am wondering if you are on an exchange server or are you sending them through your local outlook client.
If you are on an exchange server take a look at this: Exchange Emails
Or this: Exchange
I did some research and someone else was complainging about a possible 255 character limit. I find this hard to believe but hey, could be. I like Killer's idea of "create a distribution list in Outlook" That sounds like a sound idea. I didn't see any hard documentation on a character limit but it doesn't surprise me. However if you are looking to possibly try another method then there are several at the following link. I personally like CDO and there are many examples of that out on the web.
Here are a couple of Microsoft Access Examples from Microsoft. I would stay away from the Access Basic (used in MS Access 2.0). Email Examples
Hope some of this helps.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Guy Hocking |
last post by:
Hi there,
i am creating a database driven login page. I am using code that has been
successful in the past, however when i upload it to our web server it
displys the following message in the page =
******
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
General error Unable to open
|
by: MLH |
last post by:
I print to a device that creates a PDF. Knowing the filename, how can
I then embed the PDF into the body text of an OutLook Express outbound
email & send to a specified address in a table? I want recipient
addressees to see the report in the body text window of their email
when they open it. I was thinking also about attaching the PDF file to...
|
by: Atim |
last post by:
I'm trying to create an email message in Novell Groupwise (from
Access) which the user can edit before sending. Using the code below,
I can create a message just fine, but the problem is that it gets sent
out automatically, which is not what I want. If I comment out the
Call Message.Send part of the code, it stores the message in the Work...
|
by: Tom Dauria |
last post by:
I have a Access database application that sends email through Outlook.
A few years ago we started having a problem where it would ask for
each and every email being sent whether you want to give access to
your email addresses in outlook and then something about sending mail
on your behalf.
Anyway we purchased software called Outlook...
|
by: Strasser |
last post by:
In Access2000 mass emailing worked perfectly (very powerful tool!).
Doesn't work when using XP version of both Access and Outlook, even
though I checked the box to ensure that I was sending the email. Any
ideas?
Thanks in advance.
| |
by: gemma.gill |
last post by:
Hi There,
I have a button on a form within access that sends a verification e-
mail. My problem is that these e-mails are sending from individual
user accounts rather than a genieric mailbox.
Is there a way to do this?
We are using MS Outlook each user has an account set up that gives
them a personal mailbox and access to another...
|
by: ARC |
last post by:
Hello All,
I have a major application for quoting and invoicing that is written in
Access 97 (both front and back ends). I have a user base of over 300
customers, and currently I don't require that they have Access 97, as I use
the access 97 runtime scripts from Sagekey software. The main problems I've
seen with Access 97 are the built in...
|
by: Ben Sehara |
last post by:
Is there any way I can limit the access to my website? I have a site "A" and
I want to allow access to it only from site "B" login user.
If someone try to access site "A" directory, I want it redirected to site
"B" for login. After login at site "B", you see the link to site"A". When
you click it, you see login page for site "A".
Is it...
|
by: JoeP |
last post by:
Hi All,
How can I find the reason for such an error: Failure sending mail.
Some Code...
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient
oSMTP.Send(oMailMessage) (in this line I am getting the above err)
|
by: tdw |
last post by:
Hi all,
I am trying to add a feature to our database that automates sending emails.
When entering a new order, I want the option to send an email to the company the order came from, attaching a copy of our work order.
The file that I want to attach is a rich text document created by Access and stored on our server. The creation of this...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |