Tema: correo mail
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/03/2007, 06:44
luis.decolores
 
Fecha de Ingreso: marzo-2007
Mensajes: 55
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: correo mail

basicamente es esto:

<%@ Page Language="VB" Debug="true" %>
<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">

Sub Send2Mail (sender as Object, e as EventArgs)

Dim objMail as New MailMessage()

objMail.To = "[email protected]"
objMail.From = strEmail.Text

objMail.BodyFormat = MailFormat.Text
objMail.Priority = MailPriority.Normal
objMail.Subject = strSubject.Text

objMail.Body = "Name : " + strName.Text + vbNewLine + "Email : " + strEmail.text + vbnewLine + "Message : " + strYourMsg.text

SmtpMail.SmtpServer = "mail.smtp.gmail.com"
SmtpMail.Send(objMail)


strMessage.Visible = true

End Sub

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "hxxp://xxx.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="hxxp://xxx.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>How to send email</title>
</head>
<body>

<asp:panel id="strMessage" runat="server" Visible="False">
Thanks for your kind message ... </asp:panel>

<form id="Form1" runat="server">
<b>First Name:</b> <br/>
<asp:textbox id="strName" runat="server" />
<br><br>

<b>Email Address:</b><br/>
<asp:textbox id="strEmail" runat="server" />
<br><br>

<b>Subject:</b><br/>
<asp:textbox id="strSubject" runat="server" />
<br><br>

<b>Your Message</b><br/>
<asp:textbox id="strYourMsg" runat="server" Columns="45" Rows="10" TextMode="MultiLine" />
<br />
<asp:button runat="server" id="func" Text="Send Message"
OnClick="Send2Mail" />
</form>
</body>
</html>