MailMessage mail = new MailMessage(); mail.To.Add("[email protected]"); mail.From = new MailAddress("[email protected]"); mail.Subject = "Test Send mail ASP.NET"; string Body = "Hi, this mail is to test sending mail" + "using Gmail in ASP.NET"; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("[email protected]", "password"); smtp.EnableSsl = true; smtp.Send(mail); Response.Write("Message send successfully");
connect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&Server.Mappath("access.mdb") pMailSMTPServer = "smtp.gmail.com" pMailUser = "[email protected]" pMailPassword = "password" pMailPort = 587
Dim myMail,HTML,strMsg Set myMail = Server.CreateObject("CDO.Message") Dim cdoConfig Set cdoConfig = myMail.Configuration With cdoConfig.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = pMailSMTPServer .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = pMailPort .Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = pMailUser '*** User ***' .Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = pMailPassword '*** Password ***' .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30 .Update End With Set Conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") conn.open Connect Sql="SELECT * FROM access Where number = "&number&" " rs.Open sql,Conn,1,3 mName = rs("name") mNumber = number mTo = rs("email") rs.Close Set rs = Nothing Conn.Close Set Conn = Nothing myMail.Configuration = cdoConfig mFrom = "[email protected]" mSubJect = "xxxxxxxxxx" strMsg = "" strMsg = strMsg &"<table width='100%' border='0'>" strMsg = strMsg &" <tr>" strMsg = strMsg &" <td colspan='2'> </td>" strMsg = strMsg &" </tr>" strMsg = strMsg &"</table>" myMail.BodyPart.Charset = "windows-874" 'Add myMail.From = mFrom myMail.To = mTo myMail.Subject = mSubject myMail.HTMLBody = strMsg myMail.Send Response.write ("ส่ง Mail เรียบร้อยแล้ว. <div id='c' class="" onClick='window.open(" & "'','_self'" & ");window.close();'> ปิดหน้านี้</div>") Set myMail = Nothing %>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง