1. MASAHIRO HATANAKA
  2. PowerBuilder
  3. Tuesday, 27 June 2023 04:26 AM UTC

thank you always.
As the title suggests, I want to send an email with PB2017, but I'm having trouble with an error on Send.

Below is the source (minimum)
------------------------------------------------------------------------------------
OleObject lole_Msg
long rtn
any aaa
lole_Msg=create oleobject
if lole_Msg.ConnectToNewObject("CDO.Message")<0 then
messagebox('OBI','CDO.Message')
destroy lole_msg
return
else

lole_Msg.Configuration.Fields.Item('cdoSMTPServer').Value = "SMTPserver"
lole_Msg.Configuration.Fields.Item('cdoSendUsingMethod').Value = "cdoSendUsingPort"
lole_Msg.Configuration.Fields.Item('cdoSMTPServerPort').Value = 465 //portNo
lole_Msg.Configuration.Fields.Item('cdoSMTPConnectionTimeout').Value = 60 //timeout
lole_Msg.Configuration.Fields.Item('cdoSMTPAuthenticate').Value = "cdoBasic" //SMTPauth
lole_Msg.Configuration.Fields.Item('cdoSMTPUseSSL').Value = True //SSL
lole_Msg.Configuration.Fields.Item('cdoSendUserName').Value = "SMTPUSER" //send userー
lole_Msg.Configuration.Fields.Item('cdoSendPassword').Value = "SMTPPASS" //SEND PASS
//lole_Msg.Configuration.Fields.Item('cdoLanguageCode').Value = 'CdoCharset.cdoShift_JIS'
lole_Msg.Configuration.Fields.Update()
lole_Msg.Fields.Update()

 

lole_Msg.MimeFormatted = True
lole_Msg.From = "test@bbb.com" //from
lole_Msg.To = "test@aaa.com" //to
lole_Msg.Subject = "abcdefg" //subject
lole_Msg.TextBody = "xxxxxxxxxxxxxxxxx" //body

lole_msg.Send
--------------------------------------------------------------------------------
At the timing of the last Send
Application execution error (R0039)
Application has been interrupted.
Error Access error for external object property send.
An error will appear.
In VBA, it is possible to send an email without an error.
Also, regarding the items of Configuration.Fields.Item
lole_Msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver").value = "SMTP Server"
The way I wrote it above was wrong.
If anyone knows about this error, please guide me.

René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 27 June 2023 05:21 AM UTC
  2. PowerBuilder
  3. # 1

Have you tried to catch OLERuntimeError exception? This exception object has a property Description that may hold information about the error.

Comment
  1. MASAHIRO HATANAKA
  2. Wednesday, 28 June 2023 06:19 AM UTC
thank you. When I debugged based on the advice I received, I found that an error occurred in the "lole_Msg.Fields.Update()" part.



The cause was that the items had to be written in all lowercase letters!



Thank you for your advice! have a nice day!
  1. Helpful 1
  1. John Fauss
  2. Wednesday, 28 June 2023 12:52 PM UTC
That is great news! Would you please take a moment and mark this issue as resolved? Thank you.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.