26

Re: mail için activex

Soykan Bey merhaba,
Ben de aşağıdaki sistemi kullanarak mail gönderme işlemi yapıyorum.
Yanlız tek sorunum htmlformat=true olduğu halde body içindeki enter, tab vb. kaybediyor. Tüm metni yan yana formatsız gönderiyor. Sorun ne olabilir acaba, siz denediniz mi, sizde nasıl görülüyor ?

soykanozcelik yazdı:

CDOSSYS.DLL kullanılarak yapilan bir gonderim sekli , w2k ve Xp de sistemle birlikte yukleniyor yani windows built in , birden fazla kisiye mail gondermek attachment ayarlamak biraz da programciya kaliyor ama standart olarak gonderim sekli bu ve outlook veya outlook expres vs ye ihtiyaci yok.
ben bu uygulamayi cari hesap kartlarindan secim yaptirarak gonderiyorum boylelikle windows adres defteri veya outlook vs adres defteri bilgileri gerekmiyor...

Visual Fox Pro
lcFrom = "soykan@soykansoft.com"

lcTo = "soykan@soykansoft.com;soykanozcelik@gmail.com"
lcSubject = "Hey Have You Tried VFP Email?"
llHTMLFormat = .T. && change to .F. to send plain text message *!* Sending the body in HTML format
lcBody =  "body message"
lcCC = ""
lcBCC = ""
lcMailServer = "mail.soykansoft.com" && my SMTP Server
lcUserName = "soykan@soykansoft.com" && my SMTP username
lcPassword = "xxxxxx" && my SMTP password
lcAttach = m.lcTifFile
 
SendViaCDOSYS(@lcErrReturn, lcFrom, lcTo, lcSubject, lcBody, lcAttach, lcCC, lcBCC, lcMailServer, lcUserName, lcPassword, llHTMLFormat)
 
If Empty(lcErrReturn)
    Messagebox("'" + lcSubject + "' Başarıyla Gönderildi", 64, "CDOSYS Mail Sending System")
Else
    Messagebox("'" + lcSubject + "' Gönderilemedi.  Sebebi:" + Chr(13) + lcErrReturn, 64, "CDOSYS Mail Sending System")
Endif
 
Procedure SendViaCDOSYS(tcReturn, tcFrom, tcTo, tcSubject, tcBody, taFiles, tcCC, tcBCC, tcMailServer, tcUserName, tcPassword, tlHTMLFormat)
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&6
Local lcSchema, loConfig, loMsg, loAtt, lnCountAttachments
Try
    lcSchema = "http://schemas.microsoft.com/cdo/configuration/"
 
    loConfig = Createobject("CDO.Configuration")
 
    With loConfig.Fields
        .Item(lcSchema + "smtpserverport") = 25 && SMTP Port
        .Item(lcSchema + "sendusing") = 2 && Send it using port
        .Item(lcSchema + "smtpserver") = tcMailServer && host of smtp server
        .Item(lcSchema + "smtpauthenticate") = 1 && Authenticate
        .Item(lcSchema + "sendusername") = tcUserName && Username
        .Item(lcSchema + "sendpassword") = tcPassword && Password
        .Update
    Endwith
 
    loMsg = Createobject ("CDO.Message")
    loMsg.Configuration = loConfig
    With loMsg
        .From = tcFrom
        .To = tcTo
        If Type("tcCC") = "C"
            .CC = tcCC
        Endif
        If Type("tcBCC") = "C"
            .BCC = tcBCC
        Endif
        .Subject = tcSubject
        If tlHTMLFormat
            .HTMLBody = tcBody
        Else
            .TextBody = tcBody
        Endif
&&IF TYPE("tafiles",1) = "A"
&& FOR lnCountAttachments = 1 TO ALEN(taFiles)
&&  loAtt=.AddAttachment(taFiles(lnCountAttachments))
&& ENDFOR
&& ENDIF
        .AddAttachment(taFiles)
        .Send()
    Endwith
 
Catch To loError
    tcReturn = [Hata: ] + Str(loError.ErrorNo) + Chr(13) + ;
        [SatirNumarasi: ] + Str(loError.Lineno) + Chr(13) + ;
        [HataMesaji: ] + loError.Message + Chr(13) + ;
        [Procedure: ] + loError.Procedure + Chr(13) + ;
        [Detaylari: ] + loError.Details + Chr(13) + ;
        [Yigin: ] + Str(loError.StackLevel) + Chr(13) + ;
        [SatirIcerigi: ] + loError.LineContents
Finally
    Release loConfig, loMsg
    Store .Null. To loConfig, loMsg
Endtry
Endproc

27

Re: mail için activex

HTML'de enter (chr(13), chr(10), chr(13)+chr(10)), tab (chr(9)) normal bosluk karakterleri. Onlari HTML'de enter icin 'br' tagini kullan. Tab icin dogrudan cozum yok. Tablo gibi elemanlarla ya da style taglarla isi halledebilirsin.

* Enter icin

Visual Fox Pro
if m.tlHTMLFormat

  .HTMLBody = ;
  strtran(;
  strtran(;
   strtran(m.tcBody,;
     chr(13)+chr(10),'<br/>'), ;
     chr(13),'<br/>'),;
     chr(10),'<br/>')

28

Re: mail için activex

Eliniz değmişken hocam, bold vs. yazmak istersek yine html kodlarla mı yapacağız.
Mesajın direkt içine (body) html kodu yazarsak bold olarak gider değil mi ?
Yoksa ayrıca yapmamız gereken bir işelm var mı ?

29

Re: mail için activex

HTML gondermek istiyorsan HTMLin icerigini yazacaksin herhangi bir web sayfasinda view source ile goruldugu gibi:)
HTML taglari elle yazmak istemiyorsan DHTML gibi activexleri kullanabilirsin.

30

Re: mail için activex

html kodlarını yazdım oldu. Hocam, VFP de siz de harikasınız.
Teşekkürler.