Vlojenie IMAGE v telo pis'ma KAK??
От: Аноним  
Дата: 29.01.09 09:56
Оценка:
1 Kak Eto Delaetsia ???
2 ili.... Chto zdes' ne verno ???
###
      
        ' apply the settings to the message
      with iMsg
            set .Configuration = Conf
                    
            .To = Emails(counter)&""
            .From = "lina@eventgoinc.biz" 'application("AdminEmail")
            .Subject =     Subject
             bodySend= PrepareIMG(details)
            for cc=0 to ImgCnt-1
                   // Response.Write "dd:" & cc & "<br>"
                set objBP = iMsg.AddRelatedBodyPart( ar1(cc), ar2(cc), CdoReferenceTypeName)
                //Response.Write ar1(cc) & "<br>" &ar2(cc) &"<br>" & CdoReferenceTypeName &"<br>" 
                objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<" & ar2(cc) & ">"
                objBP.Fields.Update
            next

            if filePath<>"" then
                 set iBp =  .AddAttachment(filePath) 
            end if
            
            .HTMLBody = details
           .Send
      end with
    

    


details=""
Set ObjMail=nothing
Next
//Response.Write "MAIL SENT , filePath=" &filePath &"<br>"
    Dim st
    st ="MailSuccecful.asp?Back=ST&num=" & MemberCounter
    
    'Response.Redirect  st
' NEW function ***********************************************
function PrepareIMG(sdata)
//Response.Write sdata&"<br>"
        dim x, ox,zdata,fdata,y,y2,img
        x=1
        
        ox=1
        while x>0
            x=InStr(sdata,"<img ")
           response.Write "<br>*" & x&"*<br>"
           
           'if x<1 then
            'x=InStr(x+1,sdata,"<input type=""image"" ")
            'end if
            'Response.Write "x=" & x & "<br>"
            if x>0 then
           response.Write "<br>" & ox & " <-> " & x-ox & "<BR>"
               zdata= Mid(sdata,ox,x-ox)
               fdata=fdata & zdata
              
               y=InStr(x+1,sdata,"/>")
               if y>0 then
                  y2=y-x+2
                  img=mid(sdata,x,y2)
                  ox=y+2
                  Response.Write img
                  img= imageRep(img)
                  fdata=fdata & img
               else
                ox=x
               end if
            else
                zdata= Mid(sdata,ox,Len(sdata)-ox)
                fdata=fdata & zdata
            end if
            
        wend
 
        PrepareIMG = fdata
        cntMails=cntMails + 1
   
end function
'*******************************************************

'*******************************************************
    function imageRep(img_1)
        dim ss,im1,im2,arim,v,v1,v2,vs,k1,k2,p1,p2,myImg,imgName,ServerName
        ss=img_1
        v = InStr(1,img_1,"src=")
        if v>0 then
        
            arim = Split(img_1,"src=") 
            
            im1=arim(0)
            im2=arim(1)
            'Response.Write "im2=" & im2 & "<br>"
            v1 = InStr(1,im2,"'")
            v2 = InStr(1,im2,"""")
            vs=""
            if v1>0 then vs="'"
            if v2>0 then vs=""""
            if vs<>"" then
            
                k1 = InStr(1,im2,vs)
                k2 = InStr(k1+1,im2,vs)
                p1 = k1+1
                p2= k2-k1-1
                myImg= Mid(im2,p1,p2)
                ServerName=""
                myImg = Replace(myImg,"http://","")
                myImg = Replace(myImg,ServerName,"")
                myImg = Replace(myImg,"%20"," ")
                myImg = Replace(myImg,"eventgosps","") ' "172.25.10.102"
                myImg = server.mappath("../../../") & myImg
               Response.Write "koko= " & myImg & "<br>"
               //Response.end
                dim fs
                set fs=Server.CreateObject("Scripting.FileSystemObject")
                if fs.FileExists(myImg)=true then

                imgName = fs.GetFileName(myImg)
                imgName = Replace(imgName,"-","_")
                ar1(ImgCnt) = myImg
                ar2(ImgCnt) = imgName
                ImgCnt = ImgCnt+1
                ss = im1 & "src=cid:" & imgName & Mid(im2,k2+1)
                 Response.Write "ss= " & ss & "<br>"
                end if
                set fs=nothing
                
            end if
        end if
        
        imageRep=ss
        
    end function
###


Оформил код. ДХ
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.