1

Konu: Hata

Herkese kolay gelsin.

oMSG = CREATEOBJECT('cdo.message')
oMSG.To = 'kuytup@gmail.com'
oMSG.From = 'me'
oMSG.Subject = 'Hello Email'
oMSG.TextBody = 'This is an easy way to create an email'
oMSG.Send()

Şöyle mail için gözümü bir kod çarptı.
Bir denedim hata veriyor neden acaba

Ole odispath exception code 0 from CDO.message1.
"SendUsing" yapılandırma değeri gecersiz


İyi Çalışmalar.

2

Re: Hata

oMSG.From = 'me'
oMSG.From="" kime gideceğini belirten mail adresi olması gerekmiyor mu ?

3

Re: Hata

Evet biraz önce farkettim orayı değiştirdim ama gene bir şey farketmedi.
Aynı hatayı veriyor.

4

Re: Hata

anladığım kadarıyla mail göndermek istiyorsun ;
soykan hocanın kodu
cdo_mail.prg

Visual Fox Pro
Function SendMailViaCDO

      &&----- kullanilisi ----------------------------------------------------------------------
      &&xreply= "soykan@soykansoft.com" &&dbf ini yada biryerden alinacak bu bilgiler
      &&xto="soykan@soykansoft.com"
      &&xcc=""
      &&xbcc=""
      &&xfrom="soykan@soykansoft.com"
      &&xsubject="test cdo"
      &&xbody="body message.."
      &&xattach=Sys(5)+Curdir()+'fistipi.xls'
      &&=SendMailViaCDO(xserver,xaccount,xreply,xto,xcc,xbcc,xfrom,xsubject,xbody,xattach)
      &&------------------------------------------------------------------------------------------
      Lparameters tcServer,tcAccountName,tcReplyAddress,tcTo,tcCC,tcBCC,tcFrom,tcSubject,tcTextbody,tcAttachment
      Local LcServer,LcAccountName,LcReplyAddress,LcTo,LcCC,LcBCC,LcFrom,LcSubject,LcTextbody,LcAttachment
      Wait Window "Lütfen Bekleyiniz..e-mail gönderim için hazırlanıyor .........." Nowait
      LcTo=m.tcTo
      LcCC=m.tcCC
      LcBCC=m.tcBCC
      LcFrom = m.tcFrom
      LcSubject=m.tcSubject
      LcTextbody=m.tcTextbody
      LcAttachment=m.tcAttachment
      LcServer = m.tcServer &&"mail.soykansoft.com"
      LcAccountName = m.tcAccountName &&"soykan"
      LcReplyAddress = m.tcReplyAddress &&"soykan@soykansoft.com"
      cdoMessage = Createobject("CDO.Message")
      cdoConfig  = Createobject("CDO.Configuration")
      confFields = cdoConfig.Fields
      With cdoConfig.Fields
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")               = m.LcServer
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")           = 25
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing")                = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")               = .F.
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname")          = m.LcAccountName
        .Item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")         = m.LcReplyAddress
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress")= m.LcReplyAddress
  &&      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")         = cdoNone
      &&    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "domain\username"
      &&    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
        .Update
      Endwith
      With cdoMessage
        .Configuration = cdoConfig
        .To = m.LcTo &&"soykan@soykansoft.com"
        .CC = m.LcCC &&""
        .BCC = m.LcBCC &&""
        .From = m.LcFrom &&"My CDO test"
        .Subject = m.LcSubject &&"Test emailing with CDO"
        .TextBody = m.LcTextbody &&"This is a test."
*      .AddAttachment(m.LcAttachment)
        .Send()
      Endwith
      Store .Null. To cdoMessage,cdoConfig
      Wait Window "e-mail başarıyla gönderildi ........." Nowait
      Endfunc

kullanımı için
benim formda textbox var bunun clicine ;

Visual Fox Pro
if !empty(this.Value)

        Local LcTiffFileName
        *************randevu kayıtları ayarlanıyor
        select tarih,asi from randevu where randevu.no=hasta.no into cursor mailran
        sele mailran
            m.tarih=mailran.tarih
            m.Asicinsi=mailran.asi
        ranmal="Randevu Tarih    :________________Randevu nedeni"+chr(13)
        *ranmal=DTOC(m.tarih)+"            "+m.asicinsi+chr(13)
        do while !Eof()
            m.tarih=mailran.tarih
            m.Asicinsi=mailran.asi
            ranmal=m.ranmal+"  "+dtoc(m.tarih)+"____________________"+m.asicinsi+chr(13)
            skip
        endd
        *******************aşı kayıtları ayarlanıyor
        select atar,asi from asilama where asilama.no=hasta.no into cursor mailasi
        sele mailasi
            m.tarih=mailasi.atar
            m.Asicinsi=mailasi.asi
        ranasi="Aşılama Tarih    :___________________Yapılan Aşı"+chr(13)
        *ranmal=DTOC(m.tarih)+"            "+m.asicinsi+chr(13)
        do while !Eof()
            m.tarih=mailasi.atar
            m.Asicinsi=mailasi.asi
            ranasi=m.ranasi+"  "+dtoc(m.tarih)+"____________________"+m.asicinsi+chr(13)
            skip
        endd
        *LcTiffFileName = "cdo-mail.prg" && maille gidecek ek dosya kaldırılacak bizde yok
        *LcTiffFileName =""
        *Select * From Addbs(m.gcdata)+'email' Into Cursor CrsEmail  &&mail server ayarlari aliniyor yada burada tanimlanabilir
        Local xserver,xaccount,xreply,xto,xcc,xbcc,xfrom,xsubject,xbody,xattach
*        xserver=Alltrim("mail.veterinerx.com") &&"mail.xxx.com"
        xserver=Alltrim(setup.pop3) &&"mail.xxx.com"
*        xaccount= Alltrim("yyyy") &&"yyy"
*        xreply= Alltrim("avrasya@veterinerx.com") &&"soykan@soykansoft.com"
        xreply= Alltrim(setup.amail11) &&"soykan@soykansoft.com"
        &&xto=Alltrim(CrsEmail.cto) &&"soykan@soykansoft.com"
        *xto=Inputbox("Alıcı Mail Adresi...","posta@veterinerx.com")
        xto=hasta.amail
        *If Empty(xto)
        *xto=Alltrim("avrasya@veterinerx.com") &&"soykan@soykansoft.com"
        *Endif
        xcc=Alltrim("") &&""
        xbcc=Alltrim("") &&""
        xfrom=Alltrim("avrasya@veterinerx.com") &&"soykan@soykansoft.com"
        xsubject=Alltrim(setup.ad11) &&"test cdo"
        xbody="Sn "+Alltrim(hasta.adi)+" "+Alltrim(hasta.soyadi)+chr(13)+;
            "Kliniğimize kayıtlı olan "+Alltrim(hasta.padi) + "'nin aşı zamanı gelmiştir"+chr(13)+;
            "En kısa zamanda lütfen kliniğimize uğrayınız"+chr(13)+;
            "Randevu dökümünüz aşağıdaki gibidir"+chr(13)+chr(13)+chr(13)+ranmal+chr(13)++chr(13)+;
            "Bu ana kadar Kliniğimizce yapılmış Aşılarıysa aşağıdadır."+chr(13)+chr(13)+ranasi+chr(13)+chr(13)+chr(13)+chr(13)+;
            "Bizleri seçtiğiniz için teşekkürler"
*        =STRTOFILE("KONU :"+xsubject+CHR(13)+"server : "+xserver+CHR(13)+"reply : "+xreply+CHR(13)+"to : "+xto+CHR(13)+xbody,"kaydedilecekdosya.txt")
        MODIFY COMMAND kaydedilecekdosya.txt
        *xattach=Sys(5) + Curdir() + m.LcTiffFileName
        Set Procedure To cdo_mail Additive
        =SendMailViaCDO(m.xserver,m.xaccount,m.xreply,m.xto,m.xcc,m.xbcc,m.xfrom,m.xsubject,m.xbody,m.xattach)
        ****************************
 
endif

5

Re: Hata

Yukarıdaki hata veren kodu hiç değiştirmeden ben çalıştırdığımda hata vermedi, bilginize.