Emailing multiple recipients

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,


I have been using CDO to email pdf attachments to my employees, and for the most part it has been successful. I now am facing two different issues I am hoping to get some assistance with.

The first is that a majority of the emails that I send are email to texts, where I have a phone number and a wireless carrier, and the carrier supplied email address, and then the email can be received as a text with an attachment (sms/mms). The problem us that about half of the recipients only receive the text and not the attachment, and others receive nothing at all (yet the lucky half gets everything) All standard emails receive it with no hiccups.

Note: I have discovered that T-Mobile no longer supports the service, but all other carriers do.

Sub E_Prep() Dim r As Range, c As Range
Dim sTo As String, ppdf As String, pdf As String, p As String

'Path PDF
'ppdf = ThisWorkbook.Path
ppdf = Worksheets("Settings").Range("C3").Value2
If Right(ppdf, 1) <> "\" Then ppdf = ppdf & "\"

'PDF filename
p = Worksheets("Settings").Range("C5")
' p = Worksheets("Print").Range("D1").Value2 & " " & _
' Replace(Worksheets("Scheduler").Range("H84").Text, "/", "-")
pdf = ppdf & p & ".pdf"
'Debug.Print pdf
Sheets("Print").Visible = True
Sheets("Print").Select
Rows("5:56").Hidden = True
Rows("57:65").Hidden = False
Rows("66:76").Hidden = True
Application.Run "module2.HidePrep"
'Call HideFOH
'Make PDF no need for range - just hide cells based on which sheet FOH,BOH, you want to send
PublishToPDF pdf, Worksheets("Print") '.Range("D1:AB30")
'Set range for FOH
Set r = Worksheets("Employees").Range("K58:L65")
For Each c In r
With c
If InStr(.Value2, "@") <> 0 Then sTo = sTo & "," & .Value2
End With
Next c

If sTo = "" Then
MsgBox sTo, vbCritical, "Ending Macro - Missing email(s)"
Exit Sub
End If

sTo = Right(sTo, Len(sTo) - 1)
'This is the split for putting a custom message instead of the default message
If Sheets("Settings").Range("c12").Value = "test" Then
Gmail "myEmail@email.com", "mySecretPassword", "", _
"o> " & vbNewLine & "Here is the upcoming schedule, updated as of " & Now & vbNewLine & "Regards," & vbNewLine & "Scheduler." & vbNewLine & "" & vbNewLine & "" & vbNewLine & "Please do not respond to this message.", _
sTo, _
"1@2.3", _
pdf
Else
Gmail "myEmail@email.com", "mySecretPassword", "", _
"o> " & vbNewLine & "Here's the upcoming schedule and a special message from " & Sheets("Custom").Range("C4").Value & vbNewLine & "Regards," & vbNewLine & "Scheduler" & vbNewLine & "" & vbNewLine & Sheets("Custom").Range("C5").Value & vbNewLine & "- " & Sheets("Custom").Range("C4") & vbNewLine & "" & vbNewLine & "Please do not respond to this message.", _
sTo, _
"1@2.3", _
pdf
End If

MsgBox "All Done"
End Sub

Are there any possible solutions to fix this?

One solution that I can up with, is one that I need some assistance with. I figured instead of sending a pdf section of cells to a particular email or two could I make the message body a cell range? The challenge is that each employee can have two contact emails (text & standard) and I would like to send their unique schedule to them.

Here is the primary portion of the emailing code. Any help would be wonderful.

- Andrew
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top