Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

smtp DeliveryMethod

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sonu - 09 Mar 2008 01:46 GMT
Any help with -

'=========== THIS PART IS NOT WORKING ========
section in the code.

I'm not able to send using emails using "C:\temp\" folder!

Any idea!
Thanks
-------------------------------------------------------------------------

Sub SendAsync()
Try
           Dim strmsgBody As String = "hello world:
           Dim item As String

           'Listbox1 items
           'email@hotmail.com
           'email2@hotmail.com
           'email3@hotmail.com and so on...

           For Each item In ListBox1.Items
               Dim mail As New Net.Mail.MailMessage()
               Dim smtp2 As New Net.Mail.SmtpClient("hostname", "25")
               Dim cred As New Net.NetworkCredential("username",
"password")

               smtp2.Credentials = cred
               mail.IsBodyHtml = False
               Dim userState As Object = mail

               AddHandler smtp2.SendCompleted, AddressOf
SmtpClient_OnCompleted

               '=========== THIS PART IS NOT WORKING ========
               smtp2.DeliveryMethod =
Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory
               smtp2.PickupDirectoryLocation = "C:\temp\"
               '=========== THIS PART IS NOT WORKING ========

               smtp2.SendAsync("from@email.com", item.ToString, "Subject",
strmsgBody, userState)
               smtp2 = Nothing
           Next

       Catch ex As Exception
           MessageBox.Show(ex.Message)
       End Try
End Sub

Public Sub SmtpClient_OnCompleted(ByVal sender As Object, ByVal e As
System.ComponentModel.AsyncCompletedEventArgs)
       Dim mail As Net.Mail.MailMessage = CType(e.UserState,
Net.Mail.MailMessage)
       Dim subject As String = mail.Subject

       If e.Cancelled Then
           MessageBox.Show("Send canceled for mail with subject:", subject,
MessageBoxButtons.OK, MessageBoxIcon.Error)
       End If

       If Not (e.Error Is Nothing) Then
           MessageBox.Show("error")
       Else
           MessageBox.Show("msg sent")
       End If
   End Sub
Kevin Spencer - 10 Mar 2008 12:55 GMT
I would have to guess that "C:\Temp" is not the pickup directory for your
SMTP server.

Signature

HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

> Any help with -
>
[quoted text clipped - 64 lines]
>        End If
>    End Sub

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.