Problem sending a report via email

delphi package - automated exception handling
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Problem sending a report via email

Post by emailaya »

Hi

I set madexcept to send the report via smtp and "act as smtp client".
I entered the smtp server, account and password.
On several computers it works as expected but on others it gives a popup that there was an error (without any description) sending the report and the report is lost.

I guess the problem is related to a blocked port so how can I know that there was an error so I can give the user another option to send me the bug report?
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

Any feedback on this one?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

You can enable e.g. MAPI in addition to SMTP. If SMTP fails, madExcept will then automatically use MAPI.

Alternatively, you can use RegisterExceptActionHandler() to overwrite madExcept's bug report sending. In your handler you can then call the exported madExcept functions like "SendSmtpMail()" manually, check the result and maybe do other stuff if it fails.
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

I now enabled the MAPI as well but if the client does not have an email client installed (if he is using Gmail web for example) then it won't work.

I do catch the exception to manually process it and after processing it, I call exceptIntf.SendBugReport(); but it's a procedure so there is no return value

I also tried to change it to use SSL but it doesn't let me enter the port (a bug?) so maybe it's using the wrong one

I see there is a function called sendsmtpmail but do you have an example on how to use it along with the bug report as an attachment?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

You could check what "TIMEException.SendBugReport" does internally. It calls "SendBugReportEx". Which is also what the function "madExcept.SendBugReport" does. So you could call "madExcept.SendBugReport" instead of "exceptIntf.SendBugReport" to get a result value. I don't really have an example right now. I'd have to browse through the madExcept source code to figure out the details myself.
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

I started playing with SendSmtpMail and gave it the ssl version (server/port) of sending an email but it fails with no error message so I don't know why. When giving it the no-ssl version (server/port), it works but while port 25 is mostly blocked, maybe the ssl port isn't so how can I make it use the ssl port? In madexcept settings window I can't change the port and in the function it fails with no reason

Also, I tried
if madExcept.SendBugReport(exceptIntf.BugReport,nil) <> yes then
showmessage('blah blah');

it failed but I didn't see my popup
Last edited by emailaya on Thu Nov 19, 2015 1:11 pm, edited 1 time in total.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

Are you using Smtp Server oder Smtp Client? For the Server you can't change all those settings. But for the client it should work just fine. It does on my PC at least.
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

weird but now I can change it.

On my computer, when sending with no encrypt and port auto (I guess 25), it works but when sending using ssl and port 465 (in gmail it works), madexcept fails with no error message
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

Well, you could try to debug madExcept.pas, don't know what else to suggest. The SSL encryption stuff is handled by Windows itself. See "TSmtp" class.
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

Usually ssl requires 2 dlls to support ssl connection, does madexcept needs them or is it using an internal support?

When compiling my project, madexcept does not have the blue bullets (though it is in the uses clause of the project) so I can't debug it
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

As I said, the SSL encryption is handled by Windows itself (win32 APIs), so I don't need any dlls.

You need to copy madExcept.pas and mad.inc into your project folder. After that you should be able to set breakpoints and debug.
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

OK, debug shows I got "'HELO failed ()" (empty ())
any idea what can cause this?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

Maybe the SSL certificate is out of date, or something? I'm not really sure. There are some additional options you can set in the call to "AcquireCredentialsHandle". Currently I'm doing:

Code: Select all

    FSchannelCred.dwFlags := 16;  // SCH_CRED_NO_DEFAULT_CREDS
You could try whether any of the other options are needed to make this specific SMTP server work. See here for a description of the other available options:

https://msdn.microsoft.com/en-us/librar ... s.85).aspx
emailaya
Posts: 249
Joined: Thu Oct 13, 2005 11:33 am
Contact:

Re: Problem sending a report via email

Post by emailaya »

The link is invalid: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

I use this email address in my gmail for sending, and I just set the smtp server and the port (465) and it works with no problem
Last edited by emailaya on Thu Nov 19, 2015 2:17 pm, edited 1 time in total.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Problem sending a report via email

Post by madshi »

Post Reply