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