1

Konu: Vfp den E-mail ile Dosya Göndermek.

Program içinden bir dosyayı outlook olmadan doğrudan bir mail adresine gönderebilir miyim?

2

Re: Vfp den E-mail ile Dosya Göndermek.

CDO Mail ile gonderebilirsin ...

Visual Fox Pro
Local LcTiffFileName

LcTiffFileName = "MyTiffile.TIF"
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(CrsEmail.cSrvName) &&"mail.xxx.com"
xaccount= Alltrim(CrsEmail.cAccount) &&"yyy"
xreply= Alltrim(CrsEmail.cReplyto) &&"soykan@soykansoft.com"
&&xto=Alltrim(CrsEmail.cto) &&"soykan@soykansoft.com"
xto=Inputbox("Alıcı Mail Adresi...","e-mail Report")
If Empty(xto)
xto=Alltrim(CrsEmail.cto) &&"soykan@soykansoft.com"
Endif
xcc=Alltrim(CrsEmail.cCC) &&""
xbcc=Alltrim(CrsEmail.cBcc) &&""
xfrom=Alltrim(CrsEmail.cFrom) &&"soykan@soykansoft.com"
xsubject=Alltrim(CrsEmail.cSubject) &&"test cdo"
xbody=Alltrim(CrsEmail.cBody) &&"body message.."
xattach=Sys(5) + Curdir() + m.LcTiffFileName
Set Procedure To prg\cdo_mail Additive
=SendMailViaCDO(m.xserver,m.xaccount,m.xreply,m.xto,m.xcc,m.xbcc,m.xfrom,m.xsubject,m.xbody,m.xattach)


cdo_mail kodlari

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 sending via CDO .........." 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 has been succesfully send via CDO ........." Nowait
Endfunc