I have been asked to create a job to run daily which sends a list of todays shipments to each customer.
I have a table with required detail of 'todays shipments' and the customers email addresses
[Cust E-Mail],[Ship No],[Item Number], [Qty],[Sell-to Customer No_],[Sell-to Customer Name],[Package Tracking No_]
I am quite familiar with using Dbmail for sending HTML emails however I do not know how I can loop through the relevant customers selecting their data and sending to their email address.
Any guidance would be greatly appreciated.
Asked
Active
Viewed 314 times
1

jarlh
- 42,561
- 8
- 45
- 63

user17135808
- 11
- 1
-
_how I can loop through the relevant customers_ You start by looping. How do you loop over a set of rows? Use a cursor. – SMor Oct 12 '21 at 20:34
-
Does this answer your question? [Sending email dynamically to multiple recipients with message using sp\_send\_dbmail](https://stackoverflow.com/questions/44966038/sending-email-dynamically-to-multiple-recipients-with-message-using-sp-send-dbma) – SMor Oct 12 '21 at 20:35
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Oct 14 '21 at 19:49
-
This looks on the face of it to be close to what I need, thank you. However, I am unable to spend time on this right now and should return to it shortly. – user17135808 Oct 17 '21 at 16:09