5 pts.
 Email Notification
Hey i am creating an application front end = vb.net and back end = sql server db!! the application helps assign staff to jobs and when an assignment occurs i would like the staff to recieve an email informing them that they have been assigned to a job... can anyone help me out with how i would go about doing this... HELP PLEASE

Software/Hardware used:
vb.net and sql server
ASKED: November 17, 2009  12:09 AM
UPDATED: January 23, 2010  3:08 AM

Answer Wiki:
Here is the function I wrote and use in my code. You will need to Import System.Net and System.Net.Mail at the top of the page you put it in. Below the code is the link to the reference pages for these two classes. <pre> Private Function SendMail(Server As String, User As String, Password As String, Sender As String, Recipient As String, Subject As String, Body As String) AS Boolean Dim client As SmtpClient Dim email As MailMessage email = New MailMessage(Sender, Recipient, Subject, Body) client = New SmtpClient(Server) client.UseDefaultCredentials = False client.Credentials = new NetworkCredential(User, Password) Try client.Send(email) Catch ex As System.Exception 'You'll need some code here to get an error message back to you. Return False End Try Return True End Function </pre> <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx">System.Net.Mail.SmtpClient</a> <a href="http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx">System.Net.Mail.MailMessage</a> Look at this one to figure out how to add CC and such.
Last Wiki Answer Submitted:  January 23, 2010  3:02 am  by  Gent01   1,855 pts.
All Answer Wiki Contributors:  Gent01   1,855 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

BTW, you will need an email account like the one your ISP gave you. The server will be their mail server, usually mail.yourispsdomain.com, and the user name/password for the account.

Or if you have your own mail server you can use it. If it doesn’t require you to authenticate, delete the two lines with credential in them and remove the server, user, and password parameters of the function.

 1,855 pts.