Home > database >  Use JMAIL PB, the timer event loop email crash which ace to look at the code have what problem?
Use JMAIL PB, the timer event loop email crash which ace to look at the code have what problem?

Time:10-24

Start using Mymail. DLL, sending mail (written on the timer event to send, send function is found that the attachment is the trigger) everything is normal, application background for a few weeks is no problem, then see online say jmail. DLL than Mymail. DLL to use, just speak program to switch to adjust jmail. DLL, automatically perform basic program died in the two days, the resource manager, program memory footprint growth a lot, don't know what the reason, which ace to give directions, thank

1, define the window level instance OLE object
Oleobject lole - jmail
2, define window open event creat
String ls_userid ls_password, ls_sender
Long ll_net
Lole_jmail=Create oleobject

Ls_userid=uo_send_info. Sle_user. Text
Ls_password=uo_send_info. Sle_pass. Text
Ls_sender=uo_send_info. Sle_sender. Text

Ll_net=lole_jmail. ConnectToNewObject (" Jmail. The Message ")
If ll_net=0 Then
Lole_jmail. Charset="gb2312"
Lole_jmail. Encoding="base64"//
Lole_jmail. ContentTransferEncoding="base64"//
Lole_jmail. ISOEncodeHeaders=true
Lole_jmail. Silent=true
Lole_jmail. Logging=true
Lole_jmail. From=ls_sender
Lole_jmail. FromName="co., LTD."//ls_userid//the sender name
Lole_jmail. MailServerUserName=ls_sender
Lole_jmail. MailServerPassword=ls_password//send a mailbox user password
End the if

3, perform in the timer events send function
Of_send (), the function performs a 5 seconds, the program runs two days mostly die, estimation problem here,,,
===
The core function code is as follows:
String ls_host
String ls_ready ls_finished, ls_isattach ls_flag, ls_subject, ls_body, ls_origpath, ls_origfile, ls_orig
String ls_recipient lsa_recipient []
Long ll_cnt, I, j, k, ll_net

Gb_running=True
Ll_cnt=dw_send. RowCount ()
If ll_cnt & lt;=0 Then
MessageBox (" prompt ", "please configure recipient address first!" )
The Return - 1
End the If

Ls_host=uo_send_info. Sle_host. Text
If IsValid (lole_jmail) Then
For I=1 To ll_cnt
Ls_ready=Trim (dw_send GetItemString (I, "ready"))
Ls_finished=Trim (dw_send GetItemString (I, "finished"))
Ls_isattach=Trim (dw_send GetItemString (I, "isattach"))
Ls_flag=Trim (dw_send GetItemString (I, "flag"))
Ls_recipient=Trim (dw_send GetItemString (I, "recipient"))
Ls_subject=Trim (dw_send GetItemString (I, "subject"))
Ls_body=Trim (dw_send GetItemString (I, "body"))
Ls_origpath=Trim (dw_send GetItemString (I, "origpath"))
Ls_origfile=Trim (dw_send GetItemString (I, "origfile"))
Ls_orig=ls_origpath + ls_origfile


If ls_flag='n' Then Continue;

If as_repeat="n" Then
If ls_finished='y' Then Continue;
End the If

If ls_ready='y' Then

Gf_string2array (ls_recipient, '; ', lsa_recipient [])
//the recipient
Lole_jmail. ClearRecipients ()
For j=1 to upperbound (lsa_recipient [])
If pos (lsa_recipient [j], '@') & gt; 0 Then
Lole_jmail. AddRecipient (lsa_recipient [j])
End the If
Next
Lole_jmail. Subject=ls_subject
Lole_jmail. Priority=3//Priority
Lole_jmail. Body=ls_body//email content

//accessories
If ls_isattach='y' Then
For k=1 to 1//only one attachment
//lole_jmail. Addattachment (plb_attachment. Text (I))
Lole_jmail. ClearAttachments ()
Lole_jmail. Addattachment (ls_orig)
Next
End the If

Then If lole_jmail. Send (ls_host)
Mle_1. Text=Trim (mle_1. Text) + "send success: []" + ls_origfile + ":" + "~ r ~ n
"Gf_writelog (" send success: [" + ls_origfile + "] ")
If Not of_save_send_log (ls_origfile ls_recipient) Then
Mle_1. Text=Trim (mle_1. Text) + "save log failure: []" + ls_origfile + ":" + "~ r ~ n
"Gf_writelog (" save log failure: [" + ls_origfile + "] ")
End the If
The Else
Mle_1. Text=Trim (mle_1. Text) + "send failure: [" + ls_origfile +"] : "+" ~ r ~ n
"Gf_writelog (" send failure: [" + ls_origfile + "] ")
End the if
End the If
Next
End the If
Gb_running=False
Return 1

CodePudding user response:

refer to the original poster lp007 response:
start using Mymail. DLL, sending mail (written on the timer event to send, send function is found that the attachment is the trigger) everything is normal, application background for a few weeks is no problem, then see online say jmail. DLL than Mymail. DLL to use, just speak program to switch to adjust jmail. DLL, automatically perform basic program died in the two days, the resource manager, program memory footprint growth a lot, don't know what the reason, which ace to give directions, thank

1, define the window level instance OLE object
Oleobject lole - jmail
2, define window open event creat
String ls_userid ls_password, ls_sender
Long ll_net
Lole_jmail=Create oleobject

Ls_userid=uo_send_info. Sle_user. Text
Ls_password=uo_send_info. Sle_pass. Text
Ls_sender=uo_send_info. Sle_sender. Text

Ll_net=lole_jmail. ConnectToNewObject (" Jmail. The Message ")
If ll_net=0 Then
Lole_jmail. Charset="gb2312"
Lole_jmail. Encoding="base64"//
Lole_jmail. ContentTransferEncoding="base64"//
Lole_jmail. ISOEncodeHeaders=true
Lole_jmail. Silent=true
Lole_jmail. Logging=true
Lole_jmail. From=ls_sender
Lole_jmail. FromName="co., LTD."//ls_userid//the sender name
Lole_jmail. MailServerUserName=ls_sender
Lole_jmail. MailServerPassword=ls_password//send a mailbox user password
End the if

3, perform in the timer events send function
Of_send (), the function performs a 5 seconds, the program runs two days mostly die, estimation problem here,,,
===
The core function code is as follows:
String ls_host
String ls_ready ls_finished, ls_isattach ls_flag, ls_subject, ls_body, ls_origpath, ls_origfile, ls_orig
String ls_recipient lsa_recipient []
Long ll_cnt, I, j, k, ll_net

Gb_running=True
Ll_cnt=dw_send. RowCount ()
If ll_cnt & lt;=0 Then
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related