Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CDO mail problem
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
CDO mail problem
Miscellaneous
Thread ID:
01171466
Message ID:
01171466
Views:
51
Hi All,
i've problem about sending CDO mail and i am getting mail error like below

what is wrong there ?

TIA
1429-OLE Dispatch exeption code 0 from . The server rejected one or more recipients address.The server reponses 553 sorry that domain is not in my list allowed rcpthosts(#5.7.1)
* mail sending codes
                                Select ckodu,cadi,email From Addbs(m.gcdata03)+'cari' Into Cursor CrsResult
				Do Form get_mail_recipents && select recipients from multiselect list
				Local lcRecipents,lcToList
				lcToList = Sys(5)+Curdir()+[tolist.txt] && allready created from get_mail_recipents form
				lcRecipents = Filetostr(m.lcToList)


				xserver= Alltrim(arrmail[1,1]) 
				xaccount= Alltrim(arrmail[1,2]) 
				xreply= Alltrim(arrmail[1,3]) 
				*xto=Alltrim(CrsEmail.cto) 
				xto = m.lcRecipents
	*			xto=Inputbox("Alıcı Mail Adresi...","e-mail Report")
	*			If Empty(xto)
	*				xto=Alltrim(arrmail[1,4]) 
	*			Endif
				xcc=Alltrim(arrmail[1,5])  
				xbcc=Alltrim(arrmail[1,6])  
				xfrom=Alltrim(arrmail[1,7])  
				xsubject=Alltrim(arrmail[1,8]) 
				xbody=Alltrim(arrmail[1,9])  
				xattach=Sys(5) + Curdir() + LcTiffFileName
				Set Procedure To prg\cdo_mail Additive
				=SendMailViaCDO(xserver,xaccount,xreply,xto,xcc,xbcc,xfrom,xsubject,xbody,xattach)
* cdo_mail.prg codes
Function SendMailViaCDO
Lparameters tcServer,tcAccountName,tcReplyAddress,tcTo,tcCC,tcBCC,tcFrom,tcSubject,tcTextbody,tcAttachment
Local LcServer,LcAccountName,LcReplyAddress,LcTo,LcCC,LcBCC,LcFrom,LcSubject,LcTextbody,LcAttachment

Wait Window "Please wait...e-mail sending via CDO .........." Nowait

LcTo=tcTo
LcCC=tcCC
LcBCC=tcBCC
LcFrom = tcFrom
LcSubject=tcSubject
LcTextbody=tcTextbody
LcAttachment=tcAttachment

*-------
#Define cdoBasic 1
#Define cdoNone 0
LcServer = tcServer &&"mail.XXX.com"
LcAccountName = tcAccountName &&"XXX"
LcReplyAddress = tcReplyAddress &&"soykan@XXX.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 = LcTo &&"soykan@soykansoft.com"
	.CC = LcCC &&""
	.BCC = LcBCC &&""
	.From = LcFrom &&"My CDO test"
	.Subject = LcSubject &&"Test emailing with CDO"
	.TextBody = LcTextbody &&"This is a test."
	.AddAttachment(LcAttachment)
	.Send()
Endwith
Store .Null. To cdoMessage,cdoConfig
*----
Wait Window "e-mail has been succesfully send via CDO ........." Nowait
Endfunc
* below codes creating tolist.txt file on get_mail_recipents form.sendmail()
Select email From (Thisform.mGRID1.RecordSource);
	Where llselected=.t. ;
	And ;
	Not Empty(email) Into Array emails 

If _Tally = 0
	Messagebox('there is no selected any record...',16,_Screen.ActiveForm.Caption)
	Return
Endif

Set Safety Off
Local lcRecipentList,tolist
lcRecipentList=[]
tolist=SYS(5)+CURDIR()+[tolist.txt]
For ix=1 To Alen("emails")
	lcRecipentList = lcRecipentList+Trim(emails[ix])+";"
Endfor
m.lcRecipentList = Left(m.lcRecipentList,Len(m.lcRecipentList)-1)
Strtofile(m.lcRecipentList,m.tolist)
Next
Reply
Map
View

Click here to load this message in the networking platform