Imports System.IO Imports System.Data Imports System.Web.mail Partial Class newsDetailsar Inherits System.Web.UI.Page Dim code1 As New SuperClass Public lab_id As Integer Public lab_counter As Integer Public haveblog As Boolean Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ods As DataSet If Not Page.IsPostBack Then lab_id = CInt(Request.QueryString("news")) ods = New DataSet ods = code1.selectnews(lab_id) ddlLabors.DataSource = ods.Tables(0).DefaultView ddlLabors.DataBind() If IsDBNull(ods.Tables(0).Rows(0)("haveblog")) Then haveblog = False Else haveblog = ods.Tables(0).Rows(0)("haveblog") End If Dim newscode As New news newscode.IncrementReader(Request.QueryString("news")) End If End Sub Public Function isImage(ByVal strimgName As String, ByVal strimagFolder As String, ByVal ReWidth As Integer, ByVal ReHeight As Integer) As String If (strimgName = "no") Then Return "" End If Dim strwidth As String strwidth = "width='" Dim strheight As String strheight = "height='" Dim fileHeight, fileWidth As Integer fileHeight = 0 fileWidth = 0 Dim Fs As FileStream Fs = New FileStream(MapPath(strimagFolder & strimgName), FileMode.Open, FileAccess.Read, FileShare.Read) Dim image As System.Drawing.Image image = System.Drawing.Image.FromStream(Fs) fileWidth = image.Width fileHeight = image.Height Fs.Close() Fs = Nothing ' If (fileWidth > ReWidth) Or (fileHeight > ReHeight) Then If (fileWidth > fileHeight) Then Dim wL, hL As Integer wL = ReWidth hL = (wL * fileHeight) / fileWidth strwidth = strwidth & wL & "'" strheight = strheight & hL & "'" Else Dim wL, hL As Integer hL = ReHeight wL = (hL * fileWidth) / fileHeight strwidth = CStr(strwidth & wL & "'") strheight = strheight & hL & "'" End If 'Else ' strwidth = strwidth & fileWidth & "'" ' strheight = strheight & fileHeight & "'" 'End If Return "" End Function Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click sendmail() msg1.Text = "تم الارسال بنجاح" End Sub Public Function sendmail() Dim formcode As New FormsCreator Dim ods As New DataSet ods = code1.selectnews(CInt(Request.QueryString("news"))) Dim bd As String = "" bd &= "
" bd &= "
" bd &= "" bd &= "
" bd &= "" bd &= "
 
" bd &= "
" & ods.Tables(0).Rows(0).Item("title") & "
" bd &= "
  " bd &= "
" & isImage2(ods.Tables(0).Rows(0).Item("AdPic"), "images/Stock/", 250, 250) & "" bd &= "" & ods.Tables(0).Rows(0).Item("descar") & "
" bd &= "
" Dim objEmail As New MailMessage objEmail.To = txtemail.Text ' Label1.Text = ods.Tables(0).Rows(0)("thanks") & "" objEmail.From = "info@amforum.info" objEmail.Subject = "ارسلت هذه الرسالة لك من قبل صديق يدعى " & txtname.Text objEmail.Body = "" & bd & "" objEmail.BodyEncoding = System.Text.Encoding.GetEncoding("windows-1256") objEmail.BodyFormat = MailFormat.Html objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "info@amforum.info" objEmail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "info" SmtpMail.SmtpServer = "dns.amforum.info" Try SmtpMail.Send(objEmail) Catch exc As Exception 'Label1.Text = "check by phone" & exc.Message End Try Return "" End Function Public Function isImage2(ByVal strimgName As String, ByVal strimagFolder As String, ByVal ReWidth As Integer, ByVal ReHeight As Integer) As String If (strimgName = "no") Then Return "" End If Dim strwidth As String strwidth = "width='" Dim strheight As String strheight = "height='" Dim fileHeight, fileWidth As Integer fileHeight = 0 fileWidth = 0 Dim Fs As FileStream Fs = New FileStream(MapPath(strimagFolder & strimgName), FileMode.Open, FileAccess.Read, FileShare.Read) Dim image As System.Drawing.Image image = System.Drawing.Image.FromStream(Fs) fileWidth = image.Width fileHeight = image.Height Fs.Close() Fs = Nothing ' If (fileWidth > ReWidth) Or (fileHeight > ReHeight) Then If (fileWidth > fileHeight) Then Dim wL, hL As Integer wL = ReWidth hL = (wL * fileHeight) / fileWidth strwidth = strwidth & wL & "'" strheight = strheight & hL & "'" Else Dim wL, hL As Integer hL = ReHeight wL = (hL * fileWidth) / fileHeight strwidth = CStr(strwidth & wL & "'") strheight = strheight & hL & "'" End If 'Else ' strwidth = strwidth & fileWidth & "'" ' strheight = strheight & fileHeight & "'" 'End If Return "" End Function End Class