[ kranc7 @ 13.12.2009. 02:56 ] @
Pozdrav,
radim vec duze vreme web, ali mi do sad nika nije bilo potrebno pravljenje FORME za prikupljanje informacija .. tipa: IME, PREZIME, VREME POLASKA - VREME DOLASKA, ... koristim hosting na www.domain.com ... a podaci sa forme treba da se posalju na mail koji je na Yahoo ...
Upisao sam u SmtpMail.SmtpServer = "mail4.domain.com"; predpostavljam da treba da stoji tako, jer sam to nasao na njihovom sajtu ... kao i za dole naveden ..../configuration/smtpserver","mail4.domain.com" ... ali ne znam šta da stavim od parametara za SMTPSERVERPORT, SENDUSING, SMTPAUTENTICATE ...

Kada sam testirao jednu kratku formu koja je postavljena na http://www.lekovitebanje.com/ posalje mail .. i piše SENT ... čak i forma nestane sa ekrana ... ali mi ne stizu u inbox ... što je naravno i logično jer nemam ove dole parametre .. pokušao sam na sve načine da dođem do tih informacija .. ali nikako .. maloprije sam poslao mail ovim iz domain.com ... ali inače retko kad odgovaraju ... nije prvi put da im šaljem ... nisam do sad radio u ASP.NET 2.0 ... ja koristim Fotoshop a sve to podignem uz pomoć Microsoft Web Expresion 2 ... do sad je sve funkcionisalo extra ... napravio sam gomilu sajtova ... a pošto je ASP.NET integrisan u Web Expression 2 ... hteo bih da to savladam ... makar dio koji meni treba ... u drugoj poruci cu postaviti konpletan kod za ovu malu test formu ...

SmtpMail.SmtpServer = "XXXXXXXXXXX";

msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","XXXXXXXXX");
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", XXXXX);
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",XXXXXXX);
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",XXXXXX);
[ kranc7 @ 13.12.2009. 02:58 ] @
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="c#" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Web.Mail" %>
<script runat="server">
private void btnSend_Click(System.Object sender, System.EventArgs e)
{
//Creates the message
StringBuilder sb = new StringBuilder();
MailMessage msg1 = new MailMessage();

//build our message
sb.Append("From:");
sb.Append(txtFname.Text);
sb.Append("&nbsp;");
sb.Append(txtLname.Text);
sb.Append("<br />Email:");
sb.Append(txtEmail.Text);
sb.Append("<br />Phone:");
sb.Append(txtPhone.Text);

//Sets the from, to, subject, etc...
msg1.From = txtEmail.Text;
msg1.To = tbTo.Value;
msg1.Subject = tbSubject.Value;
msg1.Body = sb.ToString();
msg1.BodyFormat = MailFormat.Html;
msg1.Priority = MailPriority.Normal;
SmtpMail.SmtpServer = "mail4.domain.com";

msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","mail4.domain.com");
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",2);
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1);
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","info");
msg1.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","deadlock");

//Change the view to remove the form
MultiView1.ActiveViewIndex = -1;

try
{
SmtpMail.Send(msg1);
lblStatus.Text = "Message sent";

}
catch
{
lblStatus.Text = "Message sent";
}
}
</script><html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 2</title>
<style type="text/css">
body, tr, td {
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
</style>
</head>

<body>

<form id="form1" runat="server">
<!-- Set your recipient info here -->
<asp:HiddenField runat="server" id="tbTo" Value="[email protected]"></asp:HiddenField>
<!-- Set your default subject here -->
<asp:HiddenField runat="server" id="tbSubject" Value="New Contact"></asp:HiddenField>
<!-- Form controls start here --->
<br />
<asp:Label runat="server" Text="Fill out your information below:" id="lblStatus"></asp:Label>
<br />
<br />
<br />
<asp:MultiView id="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View id="View1" runat="server">
<table align="center" style="width: 250px">
<tr>
<td>First Name:</td>
<td>
<asp:textbox id="txtFname" runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td>Last Name:</td>
<td>
<asp:textbox id="txtLname" runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td>Email Address:</td>
<td>
<asp:textbox id="txtEmail" runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td>Phone Number:</td>
<td>
<asp:textbox id="txtPhone" runat="server"></asp:textbox>
</td>
</tr>
<tr>
<td>
<input name="Reset1" type="reset" value="reset" /></td>
<td>
<asp:button onClick="btnSend_Click" id="Button1" runat="server" Text="Send Form" />
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</form>

</body>

</html>
[ pl4stik @ 14.12.2009. 09:27 ] @
Evo jednog od nacina kako moze da se koristi System.Net.Mail

http://www.asp.net/learn/videos/video-46.aspx