Autor Beitrag
jsfrigo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

win xp, Win7
D2010
BeitragVerfasst: Do 25.09.08 10:35 
Hallo
Ich möchte eine Mail mittels Mapi versenden.
Leider funktioniert die hier angegebene Übergabe der BCC-Empfänger nicht.
Ich rufe das ganze wie folgt auf:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure Tfemail.SendeMapiMail( Adresse , BCC, nachricht : string );
var
 s : string;
begin
  s :='Mailto: ' + Adresse ;
  if BCC <> '' then
    s := s + '?bcc=' + BCC ;
  s := s +  '?subject=' + self.eBetreff.Text + '&Body=' + Nachricht;
  if ShellExecute(Application.Handle, 'open', PChar(s), NIL,NIL, SW_SHOWNORMAL) > 32 then
  ShowMessage('Mail gesendet!');
end;


Wird eine BCC Adresse übergaben schreibt er noch ?subject in die BCC Zeile.
Übergebe ich keine BCC Adresse funktioniert alles einwandfrei.

Hat jemand eine Idee?

Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 25.09.08 10:57 
user profile iconjsfrigo hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure Tfemail.SendeMapiMail( Adresse , BCC, nachricht : string );
var
 s : string;
begin
  s :='Mailto: ' + Adresse ;
  if BCC <> '' then
    s := s + '?bcc=' + BCC ;
  s := s +  '?subject=' + self.eBetreff.Text + '&Body=' + Nachricht;
  if ShellExecute(Application.Handle, 'open', PChar(s), NIL,NIL, SW_SHOWNORMAL) > 32 then
  ShowMessage('Mail gesendet!');
end;
Wenn ein BCC angegeben wurde, dann fügst du zweimal das ? hinzu, das müsste aber nach einem BCC ein & sein, denn subject ist ja nicht mehr der erste Parameter.
Vorschlag: füge das ? schon vorher hinzu, dann ggf. das BCC mit "BCC&", dann kommt danach subject usw. und es ist egal ob davor das BCC kam oder nicht.
jsfrigo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 50

win xp, Win7
D2010
BeitragVerfasst: Do 25.09.08 11:54 
Ja jetzt klappt es
Der funktionierende Quelltext lautet wie folgt

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure Tfemail.SendeMapiMail( Adresse , BCC, nachricht : string );
var
 s : string;
begin
  s :='Mailto: ' + Adresse + '?';
  if BCC <> '' then
    s := s + 'bcc=' + BCC + '&';
  s := s +  'subject=' + self.eBetreff.Text + '&Body=' + Nachricht;
  if ShellExecute(Application.Handle, 'open', PChar(s), NIL,NIL, SW_SHOWNORMAL) > 32 then
  ShowMessage('Mail gesendet!');
end;


Moderiert von user profile iconGausi: Delphi-Tags hinzugefügt. Bitte demnächst selber machen mit [delphi]...[/delphi] - Danke. :D
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Do 25.09.08 17:49 
user profile iconjsfrigo hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
if ShellExecute() > 32 then
ShowMessage('Mail gesendet!');

Dann aber auch 'ne Fehlermeldung im else ;)

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)