Quick ASP script? Thanks?

sujimon

New member
Hi,

Add this directive to the top of the page in code behind
Imports System.Net.Mail
Imports System.IO

Add this code to the Page_Load event of the page to send the mail

Dim credential as System.Net.NetworkCredential("youre windows live mailid","yourpassword")
Dim smtp as System.net.mail.SmtpClient
Dim mailobj as new MailMessage

maiobj.Subject="Yahoo"
mailobj.From= new MailAddress("your windows live id")
mailobj.To=new MailAddress("[email protected]")
mailobj.Body="Answers"

smtp.Host="mail.live.com"
smtp.Port=25
smtp.Credentials=credential
smtp.Send(mailObj)

If you have a windows live id use it else you need to create one. Else change the host property of the smpt object to the domain where yo have id like mail.google.com. Before that change the call to the NetworkCredential() constructor. Pass your gmail (in case of mail.google.com) id and password as parameter.

I have coded this for one of my projects and it worked then. I dont have the code with me now. This is all that I remember now and it should work fine.

HAPPY CODING
Sujit
 
Hi,

Add this directive to the top of the page in code behind
Imports System.Net.Mail
Imports System.IO

Add this code to the Page_Load event of the page to send the mail

Dim credential as System.Net.NetworkCredential("youre windows live mailid","yourpassword")
Dim smtp as System.net.mail.SmtpClient
Dim mailobj as new MailMessage

maiobj.Subject="Yahoo"
mailobj.From= new MailAddress("your windows live id")
mailobj.To=new MailAddress("[email protected]")
mailobj.Body="Answers"

smtp.Host="mail.live.com"
smtp.Port=25
smtp.Credentials=credential
smtp.Send(mailObj)

If you have a windows live id use it else you need to create one. Else change the host property of the smpt object to the domain where yo have id like mail.google.com. Before that change the call to the NetworkCredential() constructor. Pass your gmail (in case of mail.google.com) id and password as parameter.

I have coded this for one of my projects and it worked then. I dont have the code with me now. This is all that I remember now and it should work fine.

HAPPY CODING
Sujit
 
Can someone please post a very brief ASP script. I need the code for an ASP page (post in here), which when viewed by a browser, sends an email to a specified email address. IT can be, say, [email protected] for the purposes of this question. The subject line can be "Yahoo", and the body of the email can be the word "Answers". In terms of what's display to the user viewing the page, it can be something like "This is a test page". THANKS in advance and I appreciate your help.
 
Hi,

Add this directive to the top of the page in code behind
Imports System.Net.Mail
Imports System.IO

Add this code to the Page_Load event of the page to send the mail

Dim credential as System.Net.NetworkCredential("youre windows live mailid","yourpassword")
Dim smtp as System.net.mail.SmtpClient
Dim mailobj as new MailMessage

maiobj.Subject="Yahoo"
mailobj.From= new MailAddress("your windows live id")
mailobj.To=new MailAddress("[email protected]")
mailobj.Body="Answers"

smtp.Host="mail.live.com"
smtp.Port=25
smtp.Credentials=credential
smtp.Send(mailObj)

If you have a windows live id use it else you need to create one. Else change the host property of the smpt object to the domain where yo have id like mail.google.com. Before that change the call to the NetworkCredential() constructor. Pass your gmail (in case of mail.google.com) id and password as parameter.

I have coded this for one of my projects and it worked then. I dont have the code with me now. This is all that I remember now and it should work fine.

HAPPY CODING
Sujit
 
Back
Top