Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > ASP > ASP Forum > ช่วยด้วยครับหมดปัญญาแล้วส่งเมล์แล้วเป็นภาษาต่างดาว????????????ต้องแก้ตรงไหน


 

[ASP] ช่วยด้วยครับหมดปัญญาแล้วส่งเมล์แล้วเป็นภาษาต่างดาว????????????ต้องแก้ตรงไหน

 
Topic : 058742



โพสกระทู้ ( 2 )
บทความ ( 0 )



สถานะออฟไลน์



Code (ASP)
001.<%@ LANGUAGE="VBSCRIPT" %>
002.<% option explicit %>
003.<% Response.Buffer = True %>
004.<%
005. 
006. 
007. 
008.'Declaring Variables
009.Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Email
010.Dim ContactUs_Subject,ContactUs_Body,Action,IsError, ContactUs_Company, ContactUs_Phone
011. 
012.' Edit line 11 accordingly
013.smtpserver = "mail.xxxxx.com"
014.youremail = "xxxxxx"
015.yourpassword = "xxxxxxxxxx"
016. 
017.' Grabbing variables from the form post
018.ContactUs_Email = Request("ContactUs_Email")
019.ContactUs_Company = Request("ContactUs_Company")
020.ContactUs_Name = Request("ContactUs_Name")
021.ContactUs_Phone = Request("ContactUs_Phone")
022.ContactUs_Subject = Request("ContactUs_Subject")
023.ContactUs_Body = Request("ContactUs_Body")
024.Action = Request("Action")
025. 
026. 
027.' Used to check that the email entered is in a valid format
028.Function IsValidEmail(Email)
029.    Dim ValidFlag,BadFlag,atCount,atLoop,SpecialFlag,UserName,DomainName,atChr,tAry1
030.    ValidFlag = False
031.        If (Email <> "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then
032.            atCount = 0
033.            SpecialFlag = False
034.            For atLoop = 1 To Len(Email)
035.            atChr = Mid(Email, atLoop, 1)
036.                If atChr = "@" Then atCount = atCount + 1
037.                If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True
038.                If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True
039.                If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True
040.                If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True
041.            Next
042.            If (atCount = 1) And (SpecialFlag = False) Then
043.                BadFlag = False
044.                tAry1 = Split(Email, "@")
045.                UserName = tAry1(0)
046.                DomainName = tAry1(1)
047.            If (UserName = "") Or (DomainName = "") Then BadFlag = True
048.            If Mid(DomainName, 1, 1) = "." then BadFlag = True
049.            If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True
050.                ValidFlag = True
051.            End If
052.        End If
053.        If BadFlag = True Then ValidFlag = False
054.        IsValidEmail = ValidFlag
055.End Function
056.%>
057. 
058.<html>
059. 
060.<head>
061.<title>Contact Ayers Welldrilling</title>
062.</head>
063.<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
064.<link rel=stylesheet type="text/css" href="../../include/stylesheet.css">
065. 
066.<body style="font-family: Arial; font-size: 12px;">
067. 
068.<%
069.If Action = "SendEmail" Then
070. 
071.    ' Here we quickly check/validate the information entered
072.    ' These checks could easily be improved to look for more things
073.    If IsValidEmail(ContactUs_Email) = "False" Then
074.        IsError = "Yes"
075.        Response.Write("<font color=""red"">You did not enter a valid email address.</font><br>")
076.    End If
077. 
078.    If ContactUs_Name = "" Then
079.        IsError = "Yes"
080.        Response.Write("<font color=""red"">You did not enter a Name.</font><br>")
081.    End If
082. 
083. 
084.    If ContactUs_Phone = "" Then
085.        IsError = "Yes"
086.        Response.Write("<font color=""red"">You did not enter a Phone.</font><br>")
087.    End If
088. 
089.    If ContactUs_Subject = "" Then
090.    IsError = "Yes"
091.        Response.Write("<font color=""red"">You did not enter a Subject.</font><br>")
092.    End If
093. 
094.    If ContactUs_Body = "" Then
095.        IsError = "Yes"
096.        Response.Write("<font color=""red"">You did not enter a Body.</font><br>")
097.    End If
098. 
099.End If
100. 
101.' If there were no input errors and the action of the form is "SendEMail" we send the email off
102.If Action = "SendEmail" And IsError <> "Yes" Then
103. 
104.    Dim strBody
105. 
106.    ' Here we create a nice looking html body for the email
107.    strBody = strBody & "<font face=""Verdana,Geneva,Arial,Helvetica,sans-serif"">Here we create" & vbCrlf & "Submitted at: " & Now() &  vbCrLf & "<br><br>"
108.    'strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") &  vbCrLf & "<br>"
109.    'strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "<br>"
110.    strBody = strBody & "Company" & ":  " & " " & Replace(ContactUs_Company,vbCr,"<br>") & "<br>"
111.    strBody = strBody & "Phone" & ":    " & " " & Replace(ContactUs_Phone,vbCr,"<br>") & "<br>"
112.    strBody = strBody & "Name" & ":     " & " " & Replace(ContactUs_Name,vbCr,"<br>") & "<br>"
113.    strBody = strBody & "Email" & ":    " & " " & Replace(ContactUs_Email,vbCr,"<br>") & "<br>"
114.    strBody = strBody & "Subject" & ":  " & " " & Replace(ContactUs_Subject,vbCr,"<br>") & "<br>"
115.    strBody = strBody & "<br>" & Replace(ContactUs_Body,vbCr,"<br>") & "<br>"
116.    strBody = strBody & "</font>"
117. 
118.    Dim ObjSendMail
119.    Set ObjSendMail = CreateObject("CDO.Message")
120. 
121.    'This section provides the configuration information for the remote SMTP server.
122. 
123.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
124.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
125.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
126.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
127.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
128. 
129.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
130.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail
131.    ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword
132. 
133.    ObjSendMail.Configuration.Fields.Update
134. 
135.    'End remote SMTP server configuration section==
136. 
137.    ObjSendMail.To = youremail
138.    ObjSendMail.Subject = ContactUs_Subject
139.    ObjSendMail.From = ContactUs_Email
140. 
141.    ' we are sending a html email.. simply switch the comments around to send a text email instead
142.    ObjSendMail.HTMLBody = strBody
143.    'ObjSendMail.TextBody = strBody
144. 
145.    ObjSendMail.Send
146. 
147.    Set ObjSendMail = Nothing
148. 
149.' Change the success messages below to say or do whatever you like
150.' You could do a response, a redirect, or offer a hyperlink somewhere.. etc etc
151.%>
152.<div align="center"><center>
153.<table width="540" border="0"><tr><td><p>
154. 
155.<img src="Desktop/ayers-logo.jpg" alt="Ayers Logo" width="307" height="75" border="0">
156.<p>&nbsp;<br>
157. 
158.<font size="2" color="#0000FF"> Message Subject: &nbsp;&nbsp; <% =Replace(ContactUs_Subject,vbCr,"<br>") %></font>
159.</p>
160. 
161.<p>&nbsp;<br>
162.<b>Your message has been sent to Ayers Welldrilling - Thank You.</b></font>
163.<font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2"><br>&nbsp;<br>&nbsp;
164.<br>Please allow a couple days for response.
165.<br>If your message is more urgent, call 440-256-3622
166.</font>
167.</p>
168. 
169.</td></tr></table>
170.<p>&nbsp;<br>
171.<a href="index.html" title="Home">
172.Home
173.</a>
174.</p>
175.</div>
176.<% Else %>
177. 
178.<div align="center"><center>
179.<table width="540" border="0"><tr><td><p>
180.<font face="Arial, helvetica" size="5" color="#000000">
181.<img src="fush/Desktop/ayers-logo.jpg" alt="Ayers Logo" width="307" height="75" border="0">
182.<p>
183.<b>Information Request and Comments</b></font>
184. 
185.<p><font FACE="Arial, helvetica" Size=2>
186.We are interested in your comments, information requests, etc...
187.<br>Please allow a couple days for response.
188.</td></tr></table>
189. 
190. 
191.<form action="contact_us.asp" method="POST">
192.<input type="hidden" name="Action" value="SendEmail">
193. 
194. 
195.    <table width="540" border="0">
196.    <tr><td colspan="2">
197.        <font FACE="Arial" size="2">
198.        The information below is confidential and will not be distributed.</font>
199.        <hr></td>
200.    </tr>
201. 
202.    <tr><td width="150"><font FACE="Arial" size="2"><b>*Name:</b></font></td>
203.        <td>
204.        <input type="text" name="ContactUs_Name" size="35" value="<% =ContactUs_Name %>">
205.</td>
206.    </tr>
207.    <tr><td width="150"><font FACE="Arial" size="2"><b>Company:</b></font></td>
208.        <td>
209.        <input type="text" name="ContactUs_Company" size="35" value="<% =ContactUs_Company %>">
210.    </tr>
211.    <tr><td width="150"><font FACE="Arial" size="2"><b>*Phone:</b></font></td>
212.        <td>
213.        <input type="text" name="ContactUs_Phone" size="35" value="<% =ContactUs_Phone %>">
214.         </td>
215.    </tr>
216.    <tr><td><font FACE="Arial" size="2"><b>*E-mail:</b></font></td>
217.        <td>
218.        <input type="text" name="ContactUs_Email" size="35" value="<% =ContactUs_Email %>">
219.        </td>
220.    </tr>
221. 
222. 
223.    <tr><td><font FACE="Arial" size="2"><b>*Subject:</b></font></td>
224.        <td>
225.        <input type="text" name="ContactUs_Subject" value="<% =ContactUs_Subject %>" size="35">
226.        </td>
227.    </tr>
228. 
229.      <tr><td valign="top"><font FACE="Arial" size="2"><b>*Comments:</b></font></td>
230.        <td>
231.        <textarea cols="40" rows="10" name="ContactUs_Body"><% =ContactUs_Body %></textarea>
232.        </td>
233.    </tr>
234. 
235.         <tr><td colspan="2"><font FACE="Arial" size="2"><b>*</b>Required</font></td>
236.    </tr>
237. 
238.    <tr>
239.        <td>&nbsp;</td>
240.        <td>
241.            <font FACE="Arial" size="3">
242.                <input TYPE="submit" NAME="Engage" VALUE="Send Message" tabindex="15">&nbsp;
243.                <input TYPE="reset" VALUE="Reset" name="B2" tabindex="16">
244.             
245.                <b>&nbsp;&nbsp;Thank you!</b></font>
246. 
247.        </td>
248.    </tr>
249.</table>
250. 
251.</form>
252. 
253.<p><font face="Arial" size="2"><a href="index.html">Home</a></font>
254.</center></div>
255. 
256.<% End If %>
257. 
258.</body>
259. 
260.</html>




Tag : ASP

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-04-18 01:28:05 By : rush3789 View : 1896 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (ASP)
1.<%
2.ObjSendMail.BodyPart.Charset = "TIS-620"
3.%>


ถ้า CDO ให้ใช้ .BodyPart.Charset = "TIS-620" ครับ


Go to : asp ส่งเมลแบบ CDO.Message แต่ไม่เป็นภาษาไทย กลายเป็นภาษาต่างดาว หรือ ?
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-04-18 09:02:10 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยด้วยครับหมดปัญญาแล้วส่งเมล์แล้วเป็นภาษาต่างดาว????????????ต้องแก้ตรงไหน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่