UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> How Do I Get Two Cc's In An Outlook Email, Access 2016    
 
   
MisterChips
post Feb 18 2018, 12:13 PM
Post#1



Posts: 62
Joined: 29-January 17



Folks,
I hope you can throw some light on a strange problem that I can't seem to resolve.
I have a need to send out two cc's on an automated email.
No problem .... just add a semi-colon after the first address and then add the second, looking like this (I think)

imsg.cc = "address1@hotmail.com" & "; " & "address2@hotmail.com"

The problem is that I cannot get access to put in the semicolon using the above code.

below is the actual code that I have for this section of the sub.

To give some background, if required:- (probably not, but added in case needed)
I have the cc addresses in a user maintenance file "f_variables", which is where I pull the addresses from.
Sometimes the user doesn't want a cc to go out, (therefore check64 and check66)
There are often several hundred emails being sent out, and only one cc is required for each run.
I expect that they (being users), will possibly blank out the first cc in the variables file, so I need to allow for that!
None of this is important for my problem, however.

I believe that the code for a semi-colon is Chr(59).

The key problem is that in break mode the debug.print line ..... Debug.Print "second cc2 = "; imsg.CC . . .
. . . . shows a comma, not a semi-colon in the intermediate window.
However the second debug.print does show a Semi-colon in the intermediate window

DoCmd.OpenForm "f_variables", , , , , acHidden
cc1 = Forms!f_variables!cc1
cc2 = Forms!f_variables!cc2
If CountCC > 0 Then GoTo 3579
CountCC = 0
If Check64 = -1 Then ' cc to Chairman
If Not IsNull(Forms!f_variables!cc1) Then
imsg.CC = Trim(cc1)
Else: imsg.CC = ""
End If
End If
Debug.Print "first cc1 = ", imsg.CC
If Check66 = -1 Then ' cc to Secretary
If Not IsNull(Forms!f_variables!cc2) Then
imsg.CC = imsg.CC & Chr(59) & " " & cc2 ' semi-colon ' THIS LINE IS THE ONE I MEAN
Else: imsg.CC = ""
End If
End If
Debug.Print "second cc2 = "; imsg.CC
CountCC = CountCC + 1
3579

I haven't been able to debug possible others errors of logic in the code as I can't get the emails out yet.

Sorry to, perhaps confuse the issue with excess info.

Any help will be greatly appreciated.
Go to the top of the page
 
MadPiet
post Feb 18 2018, 02:33 PM
Post#2



Posts: 2,490
Joined: 27-February 09



That doesn't look like Outlook. If you're really dealing with Outlook (not SendObject wrapper to the mail client), then you'd have a Message object, and the message object has a Recipients collection, if I remember right. then you can specify something like

olkMessage.Recipients.Add(address, RecipientType).

Here's an example from antiquity... pretty sure the Romans used it when they were programming:
https://support.microsoft.com/en-us/help/20...ge-using-access
Go to the top of the page
 
MisterChips
post Feb 18 2018, 03:44 PM
Post#3



Posts: 62
Joined: 29-January 17



Sorry Madpiet.

In fact the code that I should have also added into my post s well is:-

Set imsg = CreateObject("CDO.Message")
Set iconf = CreateObject("CDO.Configuration")
Set flds = iconf.Fields
'############################################################################
#### SEND TO
schema = "http://schemas.microsoft.com/CDO/configuration/"
flds.Item(schema & "sendusing") = cdoSendUsingPort
flds.Item(schema & "smtpserver") = "in-v3.mailjet.com"
flds.Item(schema & "smtpserverport") = 25
flds.Item(schema & "smtpauthenticate") = cdoBasic ' "Auth" 'cdoBasic
flds.Item(schema & "sendusername") = "deleted"
flds.Item(schema & "sendpassword") = "deleted"
flds.Item(schema & "smtpusessl") = 1
flds.Update
Set imsg.Configuration = iconf
imsg.To = rs!Email ' rs!Email

Does this make matters clearer please?

Thanks for responding ... I appreciate your time and help on this.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    24th September 2018 - 10:26 AM