Link to home
Start Free TrialLog in
Avatar of chem_kid
chem_kid

asked on

Need to send email w/unique attachment to each customer in a sql table using vb .net

I don't mean to be redundant here, so I appologize if I am.....I see solutions similar to this, but I need more hand holding for the code.
I have added a form to my vb.net application which sends emails quite nicely via smtp.  I used the system.net.mail namespace to do so.

ok...so far so good...now here is what I can't seem to get working correctly:  My boss asked me to create an app which opens an existing table (i.e. customer billing info) in ms sql 2005, allows a user to be able to choose which customers an email is going to be sent to, and be able to hit a send button which would send the emails out.  
Here's the thing....the emails will be billing invoices.  The invoice is a different pdf file unique to each customer obviously.  Sending the attachment is no problem, nor is multiple attachments.  what I am having a problem with is sending a particular attachment(s) to a particular customer.

In essense, let's say I want it set up so that a list box containing each customer is shown on a form.  The user should be able to select the name(s) from the list, be able to type a common message in a text box on the form (i.e. "Here is your bill for August, 2007"), and be able to hit send.  An email will be sent out to each selected customer, along with a common from, subject, message body, and a unique pdf attachment.  The path of the attachment i suppose could be stored in a temp sql table if it's best.

Help me!  Should this loop through and send each mail one by one?  Should it send a bulk of emails at once?  I need to see the code for this in detail.  I hope someone can help.  BTW...I need to also have a record somewhere of what mails were send successfully or not.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

1) Are you talking about sending attachments without saving the PDF to disk?

2) Are the PDFs stored in the database, or just a file name?

Bob
Avatar of chem_kid
chem_kid

ASKER

pdf's are just files somewhere that need to be attached.
Do you need any more than this?

System.Net.Mail FAQ -- Attachment Class
http://www.systemnetmail.com/faq/2.3.aspx

Bob
i am not having trouble with the email operation.  i have that down pat.

the problem i am having is how to set it up so a sql table is read with a bunch of fields contianing email addresses and another field containing the attachment paths the email addresses correspond to.  I need the program to be able to read the through the table and send an email out to each of the addresses with the unique attachments to each.  i know i must use the recordset property and loop through and all that...but i need the code HOW.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok....i'll give it a try and let you know.
Forced accept.

Computer101
EE Admin