Avatar billede tahoo Nybegynder
27. marts 2002 - 12:26 Der er 2 kommentarer og
1 løsning

plain / text i Dundas ASP Mail

Hejsa .. (haster lidt defor mange point..)

Jeg har et problem med mit dundas ASP mail.

Jeg har lavet et script som fint kan sende mail, men mit problem er bare at den ikke sender teksten som plain/text og heller ikke som US-ASCII.. hvad skal jeg gøre for at få den til det.. tror måske den sender det som html/text /(ikke sikker...)

Jeg har indsat hele mit script her : (hvis nogle kan se hvad fejlen er må de meget gerne sætte det rigtige ind.. det vil være super :-)

----------------------------------------------------
<%@ Language=VBScript %>
<%Response.Buffer = True  'enable html buffering so we can use a Redirect anywhere in page
'*********************************** IMPORTANT ***********************************
'  A folder with the name "4AA80F25-21E4-11D4-9985-0050BAD44BCD"                   
'  will be created at the root of your c:\ drive.  If you want to
'  delete files uploaded by users then give the default web account
'  Full Control permissions for this folder only.  Then remove the
'  commenting from the "objUpload.Files(j).Delete" line below.
'*********************************** IMPORTANT ***********************************
'*********************************************************************************
'Copyright Dundas Software Ltd. 2000. All Rights Reserved.
'
'PURPOSE:          Processes the information POSTED by SendMail.asp, and then
'                    attempts to send the email to the specified address(es) along
'                    with the uploaded attachment (if any).
'
'CONTROLS USED:        Dundas Upload and Mailer controls.
'
'COMMENTS:          Maximum amount of posted data is 1 Meg.
'                    Form values are sent back to the main page using a Querystring.
'                    A maximum of 1 Megabytes of form data is allowed to be uploaded
'                    to the server (the sum of the posted form data and all uploaded
'                    files).
'
'Dundas Software Contact Information:
'    Email:    sales@dundas.com
'  Phone:    (800) 463-1492
'            (416) 467-5100
'    Fax:    (416) 422-4801
'*********************************************************************************
Sub DeleteUploads
'removes any files user uploaded from the "c:\4AA80F25-21E4-11D4-9985-0050BAD44BCD" folder
Dim j  'counter variable
For j = 0 To objUpload.Files.Count - 1
    'objUpload.Files(j).Delete
Next
End Sub
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
Dim objUpload  'stores Upload control instance
Dim strPath    'stores path to the unique folder used to store uploaded files (see notes above)
Dim Index      'counter variable
Dim objMailer  'stores Mailer control instance

'functions will throw an exception if not successful, so on error resume next is used
On Error Resume Next 

Set objUpload = Server.CreateObject("Dundas.Upload.2")    'Upload object
'if upload object creation failed then redirect to error page with a hyperlink to download page for Uplaod control
If  Err.Number <> 0 Then   
    Response.Redirect "Error.asp?Error=" & server.URLEncode("You must first install and register the <b>free</b> Dundas Upload Control 2.0 for this demo to work properly.</font><br><br>Click <a href=http://www.dundas.com/index.asp?downloads/register.asp?ProdID=22>here</a> to download the Upload control.")   
End If

Set objEmail = Server.CreateObject("Dundas.Mailer")    'Mailer object

'create temp directory to store uploaded files if it doesn't already exist
'  it is a guid, so it will be a unique folder
strPath = "c:\4AA80F25-21E4-11D4-9985-0050BAD44BCD"
objUpload.DirectoryCreate strPath

'before saving data we will make sure that the sum of the form data and all uploaded
'  files does not exceed 1 Meg.
objUpload.MaxUploadSize = 1000000

'save the uploaded files to the temp directory. This populates the Upload control's collections!    
objUpload.Save strPath
'error trap for success/failure
If Err.Number <> 0 Then
    Response.Redirect "Error.asp?Error=" &  server.URLEncode(Err.Description)
End If

'add specified To field to collection, if user did not enter a value redirect to the error page
If objUpload.Form("txtTo") <> "" Then   
    objEmail.TOs.Add objUpload.Form("txtTo")
Else
    Response.Redirect ("Error.asp?Error=" & server.URLEncode("You must enter a value for the Recipient field."))
End If

'set FromAddress property
objEmail.FromAddress = objUpload.Form("txtFrom")

'set the Subject property
objEmail.Subject = objUpload.Form("txtSubject")

'add specified Cc field to collection if specified
If objUpload.Form("txtCc") <> "" Then
    objEmail.CCs.Add objUpload.Form("txtCc")
End If

'add specified Bcc field to collection if specified
If objUpload.Form("txtBcc") <> "" Then
    objEmail.BCCs.Add CStr(objUpload.Form("txtBcc"))
End If

'check to see if SMTP relay server has been specified, if so add to collection
If objUpload.Form("txtSMTP") <> "" Then
    objEmail.SMTPRelayServers.Add objUpload.Form("txtSMTP")
End If

'set the message body
objEmail.Body = objUpload.Form("txtBody")

'now add the attachment (if it exists) to the Email control's Attachments collection
'we will also specify the original filename (which doesn't begin with a guid) to be set to the ContentName
If objUpload.Files.Count > 0 Then
    objEmail.Attachments.Add objUpload.Files(0).Path,objUpload.Files(0).OriginalPath
End If

'now send the email
objEmail.SendMail

'test for success/failure
If Err.Number <> 0 Then
    'an error occurred so redirect user to the error page
    Dim ErrString
    ErrString = Err.Description
    Call DeleteUploads      'delete the uploaded file (see section at top of page)
    Set objEmail = Nothing  'release resources
    Set objUpload = Nothing
    Response.Redirect "Error.asp?Error=" & server.URLEncode(ErrString)
Else
    'successful, so redirect back to main page, and set the QueryString "Values" to store form values to be sent back to main page
    Dim item(5)
           
    item(0) = objUpload.Form("txtSMTP")
    item(1) = objUpload.Form("txtFrom")
    item(2) = objUpload.Form("txtTo")
    item(3) = objUpload.Form("txtCc")
    item(4) = objUpload.Form("txtBcc")
    item(5) = objUpload.Form("txtSubject")
       
    Call DeleteUploads      'delete the uploaded file (see section at top of page)
   
    Set objEmail = Nothing  'release resources
    Set objUpload = Nothing
    Response.Redirect "SendMail.asp?Success=TRUE&Value1=" & server.URLEncode(item(0)) & "&Value2=" & server.URLEncode(item(1)) & "&Value3=" & server.URLEncode(item(2)) & "&Value4=" & server.URLEncode(item(3)) & "&Value5=" & server.URLEncode(item(4)) & "&Value6=" & server.URLEncode(item(5))
End If
%>
</BODY>
</HTML>
Avatar billede webbe Nybegynder
27. marts 2002 - 13:44 #1
Hvorfor ikke bare bruge JMail istedet???

Jeg synz det er meget lettere at bruge!
Avatar billede tahoo Nybegynder
27. marts 2002 - 14:15 #2
jeg kunne bare ikke få den til at funke på min win2k server.. gider du ikke give mig et link til den version du bruger.. så prøver jeg lige igen.. skal man gør noget andet ind at kører setup filen.. ??
Avatar billede tahoo Nybegynder
30. marts 2002 - 15:35 #3
brugte jmail
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester