Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kkoolsam
Starting Member
4 Posts |
Posted - 2008-10-21 : 08:32:25
|
I have created Job which used SSIS package to send mail in HTML format.I have used script task in SSIS and write HTML code. Mail will send using SMTP. buit while executing package I got error as "The specified string is not in the form required for an e-mail address" I used below code in design script part of script taskImports System.net Dim myHtmlMessage As Mail.MailMessage Dim mySmtpClient As Mail.SmtpClient myHtmlMessage = New Mail.MailMessage(from, to, "Test Mail", Startstrhtml) mySmtpClient = New Mail.SmtpClient("myservername") mySmtpClient.Credentials = CredentialCache.DefaultNetworkCredentials mySmtpClient.Send(myHtmlMessage)kindly help me to solve the error.SAM |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-10-21 : 09:36:21
|
Sam,I have used the following in my script task and it works well.Not sure if this is what you needImports SystemImports System.Net.MailImports System.Net.Mail.SmtpClient Dim myMessage As New MailMessage() Dim efrom As MailAddress Dim emailBody As String Dim SMTPServer As New SmtpClient() efrom = New MailAddress("Sender@gmail.com", "Sender") emailBody = "Hi There !" Try myMessage.From = efrom myMessage.To.Add("xx@gmail.com") myMessage.Subject = "Greetings" myMessage.Body = emailBody'You might need to turn this to True for HTML format myMessage.IsBodyHtml = False SMTPServer.Host = "10.106.08.0" SMTPServer.Send(myMessage) Catch e As Exception Console.WriteLine(ex.Message) End Try |
 |
|
|
|
|