Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2003, 06:30 AM
Registered User
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with mail attachments

Hi!

I have problems with attachmnets, when I send mail from my application. Here is the code:

Dim mySmartUpload
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.Upload

Set fs = CreateObject("Scripting.FileSystemObject")



Set posta = Server.CreateObject("jmail.smtpmail")
posta.ServerAddress = "xxx.xxx.x.xxx:xx"
posta.Silent = True



posta.AddRecipient Data("email")'I get data from database

Data.MoveNext
Loop

posta.Sender = "john.doe@mail.com"
posta.SenderName = "Sender"

posta.Subject = "Subject"
posta.Charset ="Windows-1250"
posta.ContentType = "text/html"
posta.ISOEncodeHeaders = False

posta.Body = "<b>" & title & "</b><br><br>" & content 'get that from from


'''''''''''''''''''' attachment ''''''''''''''''''''''

If mySmartUpload.files.item(1).filename <> "" Then

    path = "d:\...\...\"

    'HERE I CREATE A FILE AND PUT IN ON THE SERVER. SO I ATTACH TO THE MAIL FILE FROM THAT FOLDER ON THE SERVER. BEFORE I SAVE THE FILE I HAVE TO "CLEAN" IT OF ALL CHARACHTERS THAT COULD CAUSE PROBLEMS.

    datotekaIme = Left(mySmartUpload.files.item(1).filename, Len(mySmartUpload.files.item(1).filename) - Len(mySmartUpload.files.item(1).fileext) - 1)
    datotekaKoncnica = mySmartUpload.files.item(1).fileext
    datotekaIme = Replace(datotekaIme, " ", "")
    datotekaIme = Replace(datotekaIme," ","_")
    datotekaIme = Replace(datotekaIme,"..",".")
    datotekaIme = Replace(datotekaIme,"...",".")
    datotekaIme = Replace(datotekaIme,"(","_")
    datotekaIme = Replace(datotekaIme,")","_")
    datotekaIme = Replace(datotekaIme,"Å ","S")
    datotekaIme = Replace(datotekaIme,"Å¡","s")
    datotekaIme = Replace(datotekaIme,"È","C")
    datotekaIme = Replace(datotekaIme,"è","c")
    datotekaIme = Replace(datotekaIme,"Æ","C")
    datotekaIme = Replace(datotekaIme,"æ","c")
    datotekaIme = Replace(datotekaIme,"Ž","Z")
    datotekaIme = Replace(datotekaIme,"ž","z")
    datotekaKoncnica = Replace(datotekaKoncnica, " ", "")
        if (len(datotekaIme) > 40) then datotekaime = left(datotekaime, 40)
    datoteka = datotekaIme & "." & datotekaKoncnica

    Do While fs.FileExists(pot & datoteka)

        datotekaIme = datotekaIme & "_new"
        datoteka = datotekaIme & "." & datotekaKoncnica

    Loop

    mySmartUpload.files.item(1).saveAs(path & datoteka)

    posta.AddAttachment path & datoteka


End If

'''''''''''''''''''' attachment ''''''''''''''''''''''


posta.Execute()

set posta=Nothing

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''

The problem is that the user gets the attachment, but it has wrong format. For example: if i send some Word document let's say invitation.doc, the user gets file invitation.doc.dat And i don't now why.

Anyone?

Thanks in advance!

 
Old April 9th, 2004, 04:05 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try at

http://www.web-sale.dk/support/formmail/jmail.htm

Maybe You can help me about charset, by the way. Charset is set to windows-1250 (in jmail) and eny way i get square instead š and ž in body message.

Sorry I dont match a theme! You can snd my a mail in croatian if it is your mother tonque.

Quitter never wins &amp; winner never quits





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
E-Mail Attachments kidbass Beginning VB 6 0 October 26th, 2006 06:30 AM
Mail with Attachments software_developer_kk Classic ASP Basics 1 March 31st, 2005 12:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.