-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-30377 SendEmail exception while reading from mail server #17832
Conversation
https://track.hpccsystems.com/browse/HPCC-30377 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mckellyln a few comments, particularly concerned about backward compatibility.
eacd995
to
c641cd4
Compare
b7c2dd8
to
2d4d669
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mckellyln looks good. A few very minor comments.
ForEachItemIn(i,warnings) | ||
WUmessage(ctx, SeverityWarning, "SendEmail", warnings.item(i)); | ||
} | ||
|
||
FILESERVICES_API void FILESERVICES_CALL fsSendEmail_v2(ICodeContext * ctx, const char * to, const char * subject, const char * body, const char * mailServer, unsigned port, const char * sender, const char *cc, const char *bcc, bool highPriority) | ||
{ | ||
StringArray warnings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly better to call on to v3 to avoid duplicated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, changed
ecllibrary/std/system/Email.ecl
Outdated
@@ -20,8 +20,8 @@ RETURN MODULE | |||
* @param highPriority Optional; if true, message is sent with high priority. Defaults to false (normal priority). | |||
*/ | |||
|
|||
EXPORT SendEmail(varstring to, varstring subject, varstring body, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress'), varstring cc='', varstring bcc='', boolean highPriority=false) := | |||
lib_fileservices.FileServices.SendEmail(to, subject, body, mailServer, port, sender, cc, bcc, highPriority); | |||
EXPORT SendEmail(varstring to, varstring subject, varstring body, varstring mailServer=GETENV('SMTPserver'), unsigned4 port=(unsigned4) GETENV('SMTPport', '25'), varstring sender=GETENV('emailSenderAddress'), varstring cc='', varstring bcc='', boolean highPriority=false, boolean termJobOnFail=true) := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
picky: This parameter name isn't quite right - because it may not terminate the job. It is more like "reportFailuresAsErrors". (Raising because it is something the ECL user sees.) It doesn't need renaming elsewhere. The new parameter also needs to be included in the comment block above. Same for the other functions in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, yes, changed.
common/remote/rmtsmtp.cpp
Outdated
@@ -545,30 +557,34 @@ class CMailInfo | |||
} | |||
} | |||
|
|||
void read() | |||
bool read(int keepTrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming: Clearer if this was called numRetriesRemaining or something. keepTrying suggests a boolean parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. It is used sort of as a boolean in this func, so I named it that way. But happy to change it.
common/remote/rmtsmtp.cpp
Outdated
|
||
bool ok; | ||
int retries = 2; | ||
while (retries >= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be commoned up unto a function for the common case
info.writeAndRead(buffer, len, numretries)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, yes, cleaner code.
@@ -773,77 +800,138 @@ static const char *quit="QUIT\r\n"; | |||
|
|||
static void doSendEmail(CMailInfo & info, CMailPart const & part) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a change for now, but this would make much more sense as a member function of CMailInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
@ghalliday updates in commit 2. One question back about dropped info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Adding Dan to double check because he has some familiarity with this code.
@dcamper please can you sanity check these changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Signed-off-by: Mark Kelly <[email protected]>
Thanks. |
4c8857f
into
hpcc-systems:candidate-8.12.x
Type of change:
Checklist:
Smoketest:
Testing:
Manual testing of same code.