Send mail via application
Send mail via application
Hello Mathias,
I was tring to use my own developed exception box, however, I wasn't able to use the new methods like, p.e., SendMapiMail.
The problem is I was trying to find a way to detect if the message was correctly sent and, if not, show a message with the error.
I have seen in the source folder, there is a project for mail API tests which does what I need, but it rewrites the methods and I was trying to avoid that to keep future versions.
Is there a way to use the mail methods like the way I need?
Regards,
Joao
I was tring to use my own developed exception box, however, I wasn't able to use the new methods like, p.e., SendMapiMail.
The problem is I was trying to find a way to detect if the message was correctly sent and, if not, show a message with the error.
I have seen in the source folder, there is a project for mail API tests which does what I need, but it rewrites the methods and I was trying to avoid that to keep future versions.
Is there a way to use the mail methods like the way I need?
Regards,
Joao
The problem is that every string which the end user might see must be customizable. Now if I add dozens of different error messages, I also have to list them in the settings dialog and offer programmers the possibility to translate/customize all those error messages. I'm simply not sure whether that's worth it.
Hello Mathias,
While using the code from your Email API Tests, I've come with a problem!
If I try to send a mail using MAPI inside the exception handler, I get an error, while sending it using a normal event handler (button click), it opens the email just fine.
Using Button :
mapi dll opened successfully
mapi reports user abort
Using Exception Handler :
mapi dll opened successfully
mapi reports error
Because the forum doesn't allow attachments, here is the code :
(The Unit_SendMail.pas file has the SendMapiMail method from MailTest.pas).
Can you reproduce the problem there?
I'm using Delphi 7, Windows XP Pro SP2 and Outlook 2003.
Regards,
Joao
While using the code from your Email API Tests, I've come with a problem!
If I try to send a mail using MAPI inside the exception handler, I get an error, while sending it using a normal event handler (button click), it opens the email just fine.
Using Button :
mapi dll opened successfully
mapi reports user abort
Using Exception Handler :
mapi dll opened successfully
mapi reports error
Because the forum doesn't allow attachments, here is the code :
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var a : String;
begin
Unit_SendMail.SendMapiMail(a, '', '', '');
Memo1.Text := Memo1.Text + a;
end;
procedure TForm1.MadExceptionHandler1Exception(
const exceptIntf: IMEException; var handled: Boolean);
var a : String;
begin
Unit_SendMail.SendMapiMail(a, '', '', '');
Memo1.Text := Memo1.Text + a;
Handled := True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Raise (Exception.Create ('a'));
end;
Can you reproduce the problem there?
I'm using Delphi 7, Windows XP Pro SP2 and Outlook 2003.
Regards,
Joao