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,027

HOME > ASP > ASP CDOSYS (CDO.Message) > ASP Sending Mail with CDO.Message (Form Upload & Attach Files)



Clound SSD Virtual Server

ASP Sending Mail with CDO.Message (Form Upload & Attach Files)

ASP Sending Mail with CDO.Message (Form Upload & Attach Files) ทดสอบการส่งอีเมล์และและทำการอัพโหลดและแนบไฟล์ไปกับอีเมล์ (Upload & Attach Files) ในรูปแบบของ Contact Form


IIS SMTP Virtual Server


Syntax

Server.CreateObject("CDO.Message")


AspCdontsSendMailUpload.html

<html>
<head>
<title>ThaiCreate.Com ASP CDO.Message Send Mail</title>
</head>
<body>
<form action="AspCdoSendMaiAttachlUploadFile.asp" method="post" enctype="multipart/form-data" name="frmMain">
<table width="343" border="1">
<tr>
<td>To</td>
<td><input name="txtTo" type="text" id="txtTo"></td> 
</tr> 
<tr>
<td>Subject</td>
<td><input name="txtSubject" type="text" id="txtSubject"></td>
</tr>
<tr>
<td>Description</td>
<td><textarea name="txtDescription" cols="30" rows="4" id="txtDescription"></textarea></td>
</tr>
<tr>
<td>Attach</td>
<td><input name="Attach" type="file"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
<br>
<br>
<br>
</form>
</body>
</html>



AspCdoSendMaiAttachlUploadFile.asp

<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP CDO.Message Send Mail</title>
</head>
<body>
<%
	Dim myMail,HTML,strTo,strSubject,strDescription,strFileName

	Dim mySmartUpload
	'*** Create Object ***'	
	Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

	'*** Upload Files ***'
	mySmartUpload.Upload

	'*** Upload file1 ***'
	If mySmartUpload.Files("Attach").FileName <> "" Then
		mySmartUpload.Files("Attach").SaveAs(Server.MapPath("MyFiles/" & mySmartUpload.Files("Attach").FileName))
	End If


	'*** Send Mail ***'	
	Set myMail = Server.CreateObject("CDO.Message")

	'*** If Using Remote Server ***'
	'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") = "127.0.0.1" 
	'	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
	'	.Update 
	'End With 
	
	strTo = mySmartUpload.Form("txtTo")
	strSubject = mySmartUpload.Form("txtSubject")
	strDescription =  Replace(mySmartUpload.Form("txtDescription"),vbCrLf,"<br>")
	strFileName = Server.MapPath("MyFiles/"&mySmartUpload.Files("Attach").FileName)

	myMail.AddAttachment strFileName

	
	myMail.From = "[email protected]"
	myMail.ReplyTo ="[email protected]"
	myMail.To   = "[email protected]"
	myMail.Subject = "My Subject"
	myMail.HTMLBody = strDescription
		
	myMail.Send

	Response.write ("Mail Sending.")

	Set mySmartUpload = Nothing
	Set myMail = Nothing 
%>
</body>
</html>


Screenshot

ASP & CDOSYS

ASP & CDOSYS


aspSmartUpload







   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-10-07 13:14:24 / 2008-12-11 07:15:05
  Download : Download  ASP Sending Mail with CDO.Message (Form Upload & Attach Files)
 Sponsored Links / Related

 
ASP Config CDO.Message
Rating :

 
ASP Sending Mail with CDO.Message
Rating :

 
ASP Sending Mail with CDO.Message (HTML Format)
Rating :

 
ASP Sending Mail with CDO.Message (Reply-To Header)
Rating :

 
ASP Sending Mail with CDO.Message (Cc and Bcc)
Rating :

 
ASP Sending Mail with CDO.Message (Attachment File)
Rating :

 
ASP Sending Mail with CDO.Message (Form Upload , Zip & Attach Files)
Rating :

 
ASP Sending Mail with CDO.Message (Set Priority)
Rating :

 
ASP Sending Mail with CDO.Message (Using SMTP Server)
Rating :

 
ASP Sending Mail with CDO.Message (Using SMTP and Authentication)
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







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