Senin, 02 Juli 2018

[MS_AccessPros] sending multiple attachments through Lotusmaill

 

Friends, I need to email multiple attachments, and the code runs but fails to send anything. I can send one attachment only.

Anyone know how to do this?

Here's the function:

Public Function EmailSent(strFrom As String, strTo As String, strSub As String, strBody As String, Optional strAttach As Variant) As Boolean
On Error GoTo err_out

Dim L As LotusMail.Utility, Output As String
Set L = New LotusMail.Utility
' FROM, TO, Subject, Body, Attachment
Output = L.SendMail(strFrom, strTo, strSub, strBody, strAttach)
Set L = Nothing
EmailSent = True

GoTo exit_out
err_out:
EmailSent = False
exit_out:
'bye
End Function

And here is the calling code:

Private Sub PrepAndSendEmail()
On Error GoTo err_out
Dim db As DAO.Database
Dim rsTo As DAO.Recordset
Dim rsAtt As DAO.Recordset
Dim strsql As String
Set db = CurrentDb()
Set rsTo = db.OpenRecordset("EmailList")
Dim strTo As String
While Not rsTo.EOF
strTo = rsTo(0).Value & "; " & strTo
rsTo.MoveNext
Wend
Set rsAtt = db.OpenRecordset("pdfFiles")
Dim strAtt As String
strAtt = ""
While Not rsAtt.EOF
strAtt = "'" & rsAtt(0).Value & "', " & strAtt
rsAtt.MoveNext
Wend
strAtt = strAtt & "'"
strAtt = Left(strAtt, Len(strAtt) - 3)
strAtt = "array(" & strAtt & ")"

If EmailSent("PlannerReports@beaerospace.com", strTo, "Planner reporting test only", "Soon to be implemented", strAtt) Then
Me.txtStatus = "Emails have been sent"
Else
Me.txtStatus = "Emails were not sent"
GoTo err_out
End If

'If EmailSent("test@beaerospace.com", strTo, "test", "test", "k:\Production Control\Program Folder\PlannerRptsFromDB\NEXGEN PS PO-6-27.pdf") Then

GoTo exit_out
err_out:
MsgBox ("Error in PrepAndSendEmail: " & Err.Number & vbCrLf & Err.Description)
exit_out:
Set rsTo = Nothing
Set rsAtt = Nothing
Set db = Nothing
End Sub

Respectfully,
[RCEmailSigLogo]
Liz Ravenwood
Data Technologies
Interior Systems
Rockwell Collins
1851 So. Pantano Rd, Tucson, AZ 85710 USA
(520) 239-4808
Liz_ravenwood@beaerospace.com<mailto:Liz_ravenwood@beaerospace.com>
rockwellcollins.com<http://www.rockwellcollins.com/>

This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

[Non-text portions of this message have been removed]

__._,_.___

Posted by: Liz Ravenwood <Liz_Ravenwood@beaerospace.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar