Click here to Skip to main content
15,916,189 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalvbnormal Error.... Pin
soniasan21-Jan-08 0:04
soniasan21-Jan-08 0:04 
GeneralRe: vbnormal Error.... Pin
Colin Angus Mackay21-Jan-08 0:46
Colin Angus Mackay21-Jan-08 0:46 
GeneralRe: vbnormal Error.... Pin
divyesh143221-Jan-08 1:14
divyesh143221-Jan-08 1:14 
Generalload statment Pin
soniasan20-Jan-08 23:50
soniasan20-Jan-08 23:50 
GeneralRe: load statment Pin
Colin Angus Mackay21-Jan-08 0:43
Colin Angus Mackay21-Jan-08 0:43 
GeneralRe: load statment Pin
soniasan21-Jan-08 1:16
soniasan21-Jan-08 1:16 
GeneralRe: load statment Pin
Colin Angus Mackay21-Jan-08 7:07
Colin Angus Mackay21-Jan-08 7:07 
GeneralTime our Erro in Gmail Smtp(Code included) Pin
plural20-Jan-08 22:50
plural20-Jan-08 22:50 
Imports EmailThread
'Imports System.Web.Mail
Imports System.Net.Mail
Public Class Email

Private Sender As MailAddress
Private Receipient As New MailAddressCollection
Private Subject As String
Private Server As String
Private Body As String
Private ServerPort As Integer
Private Priority As MailPriority
Private Credentials As System.Net.NetworkCredential
Private Smtp As SmtpClient
Private email As MailMessage
Private HtmlBody As Boolean
Private DelivNotification As New DeliveryNotificationOptions
Private ReplyTo As MailAddress
Private Cc As New MailAddressCollection
Private Attach As System.Net.Mail.AttachmentCollection

Public Sub SetSMTPClient(ByVal Host As String, ByVal Port As Integer _
, ByVal EnableSSL As Boolean)
Smtp = New SmtpClient
With Smtp
.Host = Host
.Port = Port
.EnableSsl = EnableSSL
End With
End Sub
Public Sub SetCredential(ByVal domain As String, ByVal Username As String _
, ByVal Password As String)
'we create new structure credential instance
Credentials = New Net.NetworkCredential
Credentials.Domain = domain
Credentials.UserName = Username
Credentials.Password = Password
End Sub

Public WriteOnly Property SetPriority()
Set(ByVal value)
Priority = value
End Set
End Property

Public WriteOnly Property SetReceipient()
Set(ByVal value)
Receipient.Add(value)
End Set
End Property
Public WriteOnly Property SetReplyTo()
Set(ByVal value)
ReplyTo = value
End Set
End Property
Public WriteOnly Property SetAttach()
Set(ByVal value)
Attach.Add(value)
End Set
End Property
Public WriteOnly Property SetCC()
Set(ByVal value)
Cc.Add(value)
End Set
End Property

Public WriteOnly Property Setfrom()
Set(ByVal value)
Sender = value
End Set

End Property

Public WriteOnly Property setSubject()
Set(ByVal value)
Subject = value
End Set
End Property

Public WriteOnly Property setSMTPServer()
Set(ByVal value)
Server = value
End Set
End Property
Public WriteOnly Property setBody()
Set(ByVal value)
Body = value
End Set
End Property

Public WriteOnly Property setServerPort()
Set(ByVal value)
ServerPort = value
End Set
End Property

Public Sub SendEmail()
' Attach = New Net.Mail.AttachmentCollection

Dim obj As Object
email = New MailMessage
With email
.From = Sender

For Each obj In Receipient
.To.Add(obj.ToString)
Next

.Subject = Subject
.IsBodyHtml = HtmlBody
.Priority = Priority
.DeliveryNotificationOptions = DelivNotification
.ReplyTo = ReplyTo


For Each obj In Cc
.CC.Add(obj.ToString)
Next

.Body = Body

'For Each obj In Attach
' .Attachments.Add(obj)
'Next
End With

obj = Nothing
With Smtp
.UseDefaultCredentials = True
' .Credentials = Credentials
'.DeliveryMethod = SmtpDeliveryMethod.Network
.EnableSsl = True
.Port = ServerPort
End With

Try
Smtp.Send(email)
Catch ex As Net.Mail.SmtpException
MsgBox(ex.ToString)
End Try

Smtp = Nothing
End Sub
End Class



Please any help
i keep getitng the error "Time out"


phatkin

GeneralRe: Time our Erro in Gmail Smtp(Code included) Pin
plural20-Jan-08 23:15
plural20-Jan-08 23:15 
GeneralOCX contol Pin
soniasan20-Jan-08 20:51
soniasan20-Jan-08 20:51 
GeneralRe: OCX contol Pin
divyesh143221-Jan-08 1:21
divyesh143221-Jan-08 1:21 
GeneralRe: OCX contol Pin
soniasan21-Jan-08 19:22
soniasan21-Jan-08 19:22 
QuestionHow to detect lost internet connection ? Pin
cheeken2u20-Jan-08 20:15
cheeken2u20-Jan-08 20:15 
GeneralRe: How to detect lost internet connection ? Pin
Vimalsoft(Pty) Ltd21-Jan-08 0:30
professionalVimalsoft(Pty) Ltd21-Jan-08 0:30 
GeneralRe: How to detect lost internet connection ? Pin
Steven J Jowett21-Jan-08 2:19
Steven J Jowett21-Jan-08 2:19 
QuestionHow to Pass a Double Quote (")in a string ? Pin
SekharOne20-Jan-08 18:44
SekharOne20-Jan-08 18:44 
AnswerRe: How to Pass a Double Quote (")in a string ? Pin
Nilesh Hapse20-Jan-08 20:38
Nilesh Hapse20-Jan-08 20:38 
AnswerRe: How to Pass a Double Quote (")in a string ? Pin
John_Adams20-Jan-08 22:45
John_Adams20-Jan-08 22:45 
AnswerRe: How to Pass a Double Quote (")in a string ? Pin
The Mighty Atom21-Jan-08 10:20
The Mighty Atom21-Jan-08 10:20 
QuestionGlobal hooks from a Windows Service Pin
Raveheart20-Jan-08 9:15
Raveheart20-Jan-08 9:15 
QuestionDrag and Drop from One Treeview To Another Treeview By VB.Net 2005 Pin
ejaz_pk20-Jan-08 8:07
ejaz_pk20-Jan-08 8:07 
GeneralRe: Drag and Drop from One Treeview To Another Treeview By VB.Net 2005 Pin
Paul Conrad20-Jan-08 10:18
professionalPaul Conrad20-Jan-08 10:18 
QuestionRe: Drag and Drop from One Treeview To Another Treeview By VB.Net 2005 Pin
ejaz_pk21-Jan-08 2:35
ejaz_pk21-Jan-08 2:35 
QuestionInstance Pin
roger689720-Jan-08 6:31
roger689720-Jan-08 6:31 
GeneralRe: Instance Pin
Colin Angus Mackay20-Jan-08 10:50
Colin Angus Mackay20-Jan-08 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.