hi
i am developing asp application. I want that when some event occur ,EMAIL will be sent to GMAIL via my local server,
please help me to congfigure settings, and what sould be port or HOST ?
thanks
SMTP : MAIL FROM LOCAL SERVER TO GMAIL how?
Page 1 of 13 Replies - 564 Views - Last Post: 05 January 2013 - 02:54 PM
Replies To: SMTP : MAIL FROM LOCAL SERVER TO GMAIL how?
#2
Re: SMTP : MAIL FROM LOCAL SERVER TO GMAIL how?
Posted 05 January 2013 - 01:46 PM
Hi there
This code should work
This code should work
Imports System.Net.Mail
'Start by creating a mail message object
Dim MyMailMessage As New MailMessage()
'From requires an instance of the MailAddress type
MyMailMessage.From = New MailAddress("from_address_here@gmail.com")
'To is a collection of MailAddress types
MyMailMessage.To.Add("to_address_here@domain_name_here")
MyMailMessage.Subject = "GMail Test"
MyMailMessage.Body = "This is the test text for Gmail email"
'Create the SMTPClient object and specify the SMTP GMail server
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential("account uid", " account pwd")
SMTPServer.EnableSsl = True
Try
SMTPServer.Send(MyMailMessage)
MessageBox.Show("Email Sent")
Catch ex As SmtpException
MessageBox.Show(ex.Message)
End Try
#3
Re: SMTP : MAIL FROM LOCAL SERVER TO GMAIL how?
Posted 05 January 2013 - 01:57 PM
VEry thanks,,,,, a bundle of...... ur code did a miracle,
/>
but one thing more, I am working on HRMS system inwhich when HR and MANAGER approve leave , an email is generated QUESTION Is
in context to ur code , i might seek their credential too eg password,, which is not right legally..
please put some light on this issue,
but one thing more, I am working on HRMS system inwhich when HR and MANAGER approve leave , an email is generated QUESTION Is
in context to ur code , i might seek their credential too eg password,, which is not right legally..
please put some light on this issue,
This post has been edited by stayscrisp: 06 January 2013 - 05:46 AM
Reason for edit:: Removed quote
#4
Re: SMTP : MAIL FROM LOCAL SERVER TO GMAIL how?
Posted 05 January 2013 - 02:54 PM
Dont really get what you mean; Could you explain it a bit further?
This post has been edited by stayscrisp: 06 January 2013 - 05:47 AM
Reason for edit:: Removed unnecessary quote
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|