파일을 업로드하고 Classic ASP 및 Jmail을 사용하여 메일로 보내는 방법을 알고 싶습니다. HTML 형식 = 파일을 사용하여 파일을 선택하고 싶습니다.Jmail Classic ASP 업로드 파일 및 전송
답변
여기서 파일을 업로드하고 아웃 바운드 전자 메일에 첨부 할 때 해결해야 할 두 가지 사항이 있습니다.
아마도 타사 업로드 구성 요소가 필요할 것입니다. 많은 Windows 호스팅 업체는 작동중인 데모와 함께 사용할 수있는 'Persits'ASP 구성 요소 제품군을 가지고 있습니다. 자신의 서버입니까, 공유 호스팅입니까? 공유 호스팅에는 실제로 할 수있는 것과 관련이있을 수 있으므로 (예 : 최대 파일 크기, 파일 형식 등이 포함됩니다.
샘플 코드는 도움이되지만 'somecomponent'비트는 사용하는 모든 것과 인라인되어야합니다.
업로드 - 첨부
<퍼센트 '샘플 파일 양식 - Email.asp '로 이메일을 보내 하나 개 이상의 첨부 한 이메일을 보내 보자.
'Create upload form
Dim Form: Set Form = Server.CreateObject("SomeComponent.ASPForm")
'Do not upload data greater than 1MB.
Form.SizeLimit = 100*1024
Const fscompleted = 0
If Form.State = fscompleted Then 'completed
ProcessForm
End If
Sub ProcessForm
Dim eFrom, eTo, Subject, Message
'get source form fields - From, To, Subject and Message
eFrom = Form("From")
eTo = Form("To")
Subject = Form("Subject")
Message = Form("Message")
Dim objNewMail, File, FileName, FS, TempFolder
Set FS = CreateObject("Scripting.FileSystemObject")
'Get temporary folder
TempFolder = FS.GetSpecialFolder(2) & "\emailtemp"
'Create a new email message
Set objNewMail = CreateObject("CDONTS.NewMail")
Const CdoMailFormatMime = 0
objNewMail.MailFormat = CdoMailFormatMime
'Save source files to temporary folder
'Add these files to the new e-mail
For Each File In Form.Files
'If source file is specified.
If Len(File.FileName) > 0 Then
FileName = TempFolder & "\" & File.FileName
File.SaveAs FileName
objNewMail.AttachFile FileName
End If
Next
'Send the new email
objNewMail.Send eFrom, eTo, Subject, Message
'delete temporary files
For Each File In Form.Files
If Len(File.FileName) > 0 Then
FileName = TempFolder & "\" & File.FileName
FS.DeleteFile FileName
End If
Next
End Sub
%>
<br>Sample For <A Href=http://www.motobit.com>HugeASP upload</A>
<br> Let's you send one an email with one or more attachments.
<br> File size limit Is <%=Form.SizeLimit%> B (<%=Form.SizeLimit \ 1024 %>kB).
<Table Border=0>
<form method="POST" ENCTYPE="multipart/form-data">
<tr><td> From : </td><td><input Name=From Size=50></td></tr>
<tr><td> To : </td><td><input Name=To Size=50></td></tr>
<tr><td> Subject : </td><td><input Name=Subject Size=80></td></tr>
<tr><td ColSpan=2> Message:
<br><TextArea Name=Message Cols=76 Rows=10></TextArea>
</td></tr>
<tr><td ColSpan=2>E-Mail Attachments:
<Div ID=files>
Attachment 1 : <input type="file" name="File1">
</Div>
<Input Type=Button Value="Add a file" OnClick=return(Expand())
Style="border=0;background=yellow;cursor:hand">
</td></tr>
<tr><td ColSpan=2 Align=Right>
<input Name=SubmitButton Value="Send email >>" Type=Submit></td></tr>
</Form>
</Table>
<Script>
//Script To add a attachment file field
var nfiles = 1;
Function Expand(){
nfiles++
var adh = '<BR> Attachment '+nfiles+' : <input type="file"
name="File'+nfiles+'">';
files.insertAdjacentHTML('BeforeEnd',adh);
return false;
}
</Script>
감사합니다. 코드를 구현하고 자체 서버 (웹 서버와 메일 서버 호스팅)에서 테스트 해 보겠습니다. – alvahui2017
OP는 그가 Jmail을 사용하고 있다고 말했지만 어쨌든 CDONTS는 더 이상 사용하지 않는 것이 좋습니다. Windows Server 2003 또는 이후 버전에는 포함되어 있지 않습니다. CDOSYS는 현재 버전의 기본 메일 구성 요소입니다. – John
- 1. jQuery 파일 업로드 Classic-ASP
- 2. .net 및 classic asp
- 3. Datagrids 및 Classic ASP
- 4. SCp 및 Classic ASP를 사용하여 CSV 파일 전송
- 5. Classic ASP
- 6. IIS Express 및 Classic ASP
- 7. Uploadfy with Classic ASP
- 8. Classic ASP server.scriptTimeout replacement
- 9. Classic ASP Type 불일치
- 10. jquery 장점이있는 클래식 ASP 파일 업로드?
- 11. asp mvc 파일 업로드
- 12. classic asp - cdonts
- 13. DotNetOpenAuth + classic ASP + oAuth
- 14. Classic ASP Error 405
- 15. Asp Classic 잘못된 인코딩
- 16. CDO.Message Classic ASP - 첨부 파일 추가
- 17. Classic ASP 리디렉션 제목 문제
- 18. 업로드 파일 asp, AJAX
- 19. Asp classic and ajax
- 20. Classic ASP, IIS8 & VB6
- 21. classic asp server.transfer error
- 22. OWASP in Classic ASP
- 23. classic asp cint
- 24. IE7 Classic ASP 캐시
- 25. Classic ASP TouchActionButton
- 26. SQL classic asp - 조건문
- 27. asp classic 0x800a01a8 오류
- 28. Parse Server.XMLHTTP with ASP classic
- 29. ASP CLASSIC 및 절차 적 프로그래밍
- 30. Linux에서 ASP Classic 및 .NET 실행
여기에 코드를 추가해주십시오. 그리고 우리가 직면 한 문제를 알려주십시오. –