Help solve the problem. It gives an error when sending. http://rghost.ru/51172243 - source

<%@ Page Language=VB Debug=true %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OLEDB" %> <%@ Import Namespace="System.Web.Mail" %> <script runat=server> Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs) If Not IsPostBack Then Dim DBConn as OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" _ & "DATA SOURCE=" _ & Server.MapPath("" _ & "App_Data/C7EmailFile.mdb;")) DBCommand = New OleDbDataAdapter _ ("SELECT FileTitle, FileName from Files " _ & "Order By FileTitle", DBConn) DBCommand.Fill(DSPageData, _ "Files") ddlFiles.DataSource = _ DSPageData.Tables("Files").DefaultView ddlFiles.DataBind() lblMessage.Text = "Заполните все поля " _ & "и нажмите кнопку OK." End If End Sub Sub SubmitBtn_Click(Sender As Object, E As EventArgs) Dim TheMessage as String Dim TheMailMessage as New MailMessage Dim TheAttachment as New MailAttachment _ (Server.MapPath("" _ & ddlFiles.SelectedItem.Value)) TheMessage = "Спасибо за посещение нашего узла. Выбранный вами файл" _ & ": " & ddlFiles.SelectedItem.Text _ & " вложен в это письмо." TheMailMessage.From = "webmaster@a.com" TheMailMessage.To = txtEmailAddress.text TheMailMessage.Subject = "Файл" TheMailMessage.Body = TheMessage TheMailMessage.Attachments.Add (TheAttachment) SmtpMail.Send(TheMailMessage) lblMessage.Text = "Выбранный вами файл отправлен по указанному адресу" pnlForm.Visible = False End Sub </SCRIPT> <HTML> <HEAD> <TITLE>Отправка файла</TITLE> </HEAD> <BODY BACKGROUND="./bg.jpg" TEXT="black" LINK="darkred" VLINK="darkred" ALINK="red" LEFTMARGIN="20"> <form id="Form1" runat="server"> <Font Face="Tahoma"> <asp:Label id="lblTitle" Font-Size="25pt" Font-Name="Tahoma" Text="Отправка файла" runat="server" /> <IMG SRC="./line.gif"> <Font Face="Tahoma"> <BR><BR> <asp:Label id="lblMessage" Font-Size="10pt" Font-Name="Tahoma" Font-Bold="True" runat="server" /> <asp:Panel id="pnlForm" runat="server" > <BR><BR> <B>Имя файла:</B> <BR> <asp:dropdownlist id="ddlFiles" runat=server DataTextField="FileTitle" DataValueField="FileName"> </asp:dropdownlist> <BR><BR> <B>Адрес электронной почты:</B> <BR> <asp:TextBox id="txtEmailAddress" Columns="25" MaxLength="50" runat=server /> <asp:RequiredFieldValidator id="rfvEmailAddress" ControlToValidate="txtEmailAddress" Display="Dynamic" Font-Name="Verdana" Font-Size="10pt" runat=server> Необходимо ввести адрес электронной почты! </asp:RequiredFieldValidator> <BR><BR> <asp:button id="butOK" text=" OK " Type="Submit" OnClick="SubmitBtn_Click" runat="server" /> </asp:Panel> </Font> </Form> </BODY> </HTML> 
  • can you at least say what the error is and in which line (I mean not the number)? Or offer to download your source code, poking around at them or count line numbers? - DreamChild
  • Compiles the rules, but when sending to soap it gives an error and highlights it with red SmtpMail.Send (TheMailMessage) - Foxee
  • one
    VB in ASP O_O - Sugar Sugar

1 answer 1

I think you just do not have an SMTP server or it does not respond.

How you set the SmtpMail.Host and SmtpMail.Port properties ... you need to check them through telnet.