Step1:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EmailUs.aspx.cs" Inherits="Information_EmailUs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<
</head>
<body>
<form id="form1" runat="server">
<div>
<table cellpadding="0" cellspacing="0" width="100%" style="margin-top:0px;">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%"> <tr>
<td style="background-color:Navy; font-style:italic; outline-color:Aqua; text-align:center">
<marquee direction="left" margin-left="0px"
margin-right="0px" style="width: 992px; color: #00FF00;
font-size: xx-large;"> OnLine Shopping</marquee>
</td>
<td><asp:ImageButton ID="ImageButton3" runat="server"
ImageUrl="~/flashImg/telephonelogo.gif" BackColor="#000066" Height="38px"
Width="96px" /></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0"
style="width:100%; height:90px; ">
<tr>
<td style="width:100px; height:86px;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
style="height: 90px; width: 100px">
<param name="movie" value="../NetShopping/flashImg/demo.swf"/>
<param name="quality" value="high"/>
<embed src="../NetShopping/flashImg/demo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="100px" height="90px"></embed>
</object>
</td>
<td >
<asp:Image ID="Image2" runat="server" ImageUrl="~/Login/header11.jpg" Width="986px" Height="90px"></asp:Image>
</td>
</tr>
</table>
<table style="width:100%;height:30px; background-color:Navy" width="30px">
<tr>
<td style="height:30px;">
<marquee direction="up" style="height:30px; width: 319px"><asp:Image ID="img1" runat="server"
ImageUrl="~/Image/moon.jpg" Width="472px" Height="416px" /></marquee>
</td>
<td style="height:30px; width:950px;" >
<marquee direction="right" width="100%" style="font-size: x-large; color: #00FF00" > You can send me your experience bia e-mail or mobile phone</marquee>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0"
style="height: 369px; width: 100%; background-color: #C0C0C0;">
<tr>
<td align="center" valign="middle" class="style6">
Enter Ur Email:</td>
<td >
<asp:TextBox ID="TextBox1" runat="server" BackColor="#FFFFCC" Height="24px"
Width="250px" CssClass="TextBox"></asp:TextBox>
<br />
</td>
</tr>
<tr>
<td align="center" valign="middle" class="style1">
<span class="style5">Subject:</span><br class="style5" />
</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" BackColor="#FFFFCC" Height="24px"
Width="453px" CssClass="TextBox"></asp:TextBox>
</td>
</tr>
<tr>
<td valign="middle" class="style2">
Please write your message:</td>
<td valign="top" class="style3">
<asp:TextBox ID="TextBox2" runat="server" BackColor="#FFFFCC"
ForeColor="#FF0066" Height="238px" TextMode="MultiLine" Width="72%" CssClass="TextBox"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" CssClass="Button"
onclick="Button1_Click1" Text="Send" />
<asp:Label ID="Label1" runat="server"
style="font-size: x-large; color: #FF0000"></asp:Label>
<asp:Button ID="Button2" runat="server" Text="Back" CssClass="Button"
onclick="Button2_Click" />
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" style="width:100px:" >
<tr align="center" >
<td class="style4" style="background-color:Lime; color:#000080;" align="center" >
<i style="font-size: large">Developed by Mr. Shivam Gupta</i>
</td></tr>
</table>
</div>
</form>
</body>
</html>
step2:-
using System;
using System.Net;
using System.Net.Mail;
public partial class Information_EmailUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Page.Title = "FeedBack";
}
protected void Button1_Click1(object sender, EventArgs e)
{
try
{
string myemail="happygupt@gmail.com";
MailMessage m = new MailMessage(myemail, TextBox1.Text,TextBox3.Text, TextBox2.Text);
NetworkCredential n = new NetworkCredential("careercac", "sandeep123");
SmtpClient s = new SmtpClient("smtp.gmail.com", 587);
s.EnableSsl = true;
s.UseDefaultCredentials = false;
s.Credentials = n;
s.Send(m);
Label1.Text = "message has been sent successfully!!";
}
catch (Exception e1)
{
Label1.Text = "Sorry......No Network connected!!!";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Server.Transfer("~/Home.aspx");
}
}
No comments:
Post a Comment