1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
unit lrEmailAppFreeSoft;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, lrEmailExportFilter;
type
{ TEmailAppThunderbird }
TEmailAppThunderbird = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
{ TEmailAppEvolution }
TEmailAppEvolution = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
{ TEmailAppKMail }
TEmailAppKMail = class(TEmailApp)
protected
class function AppFileName:string;override;
function MakeParams:string;override;
public
class function AppName:string;override;
end;
implementation
uses
{$IFDEF WINDOWS}
registry,
{$ENDIF}
UTF8Process;
{ TEmailAppKMail }
class function TEmailAppKMail.AppFileName: string;
begin
{$IFDEF LINUX}
Result:=FindFilenameOfCmd('kmail');
{$ELSE}
{$IFDEF WINDOWS}
Result:='';
{$ENDIF}
{$ENDIF}
end;
function TEmailAppKMail.MakeParams: string;
begin
Result:='--composer '+
'--subject '+FFilter.MessageSubject+' '+
'--attach file://'+FFilter.EmailAttachFileName+' ';
if Trim(FFilter.MessageBody.Text)<>'' then
Result:=Result + '--body "'+Trim(FFilter.MessageBody.Text)+'" ';
Result:=Result + FFilter.Email;
{
Usage: kmail [Qt-options] [KDE-options] [options] [address|URL]
KDE Email Client
Generic options:
--help Show help about options
--help-qt Show Qt specific options
--help-kde Show KDE specific options
--help-all Show all options
--author Show author information
-v, --version Show version information
--license Show license information
-- End of options
Options:
-s, --subject <subject> Set subject of message
-c, --cc <address> Send CC: to 'address'
-b, --bcc <address> Send BCC: to 'address'
-h, --replyTo <address> Set replyTo to 'address'
--header <header_name:header_value> Add 'header' to message. This can be repeated
--msg <file> Read message body from 'file'
--body <text> Set body of message
--attach <url> Add an attachment to the mail. This can be repeated
--check Only check for new mail
--composer Only open composer window
--view <url> View the given message file
Arguments:
address|URL Send message to 'address' or attach the file the 'URL' points to
}
end;
class function TEmailAppKMail.AppName: string;
begin
Result:='KDE Mail App (KMail)';
end;
{ TEmailAppEvolution }
class function TEmailAppEvolution.AppFileName: string;
begin
Result:=FindFilenameOfCmd('evolution');
end;
function TEmailAppEvolution.MakeParams: string;
begin
Result:='"mailto:' + FFilter.Email +
'?subject='+FFilter.MessageSubject;
if Trim(FFilter.MessageBody.Text)<>'' then
Result:=Result + '&body='+Trim(FFilter.MessageBody.Text);
Result:=Result + '&attach=file://'+FFilter.EmailAttachFileName+'"';
end;
class function TEmailAppEvolution.AppName: string;
begin
Result:='Gnome Evolution';
end;
{ TEmailAppThunderbird }
class function TEmailAppThunderbird.AppFileName: string;
{$IFDEF WINDOWS}
var
R:TRegistry;
S: String;
{$ENDIF}
begin
{$IFDEF LINUX}
Result:=FindFilenameOfCmd('thunderbird');
{$ELSE}
{$IFDEF WINDOWS}
R:=TRegistry.Create;
R.Access := KEY_READ;
R.RootKey := HKEY_LOCAL_MACHINE;
S:='';
Result:='';
try
if R.OpenKeyReadOnly('SOFTWARE\Mozilla\Mozilla Thunderbird') then
S:=R.ReadString('CurrentVersion');
R.CloseKey;
if S<>'' then
begin
S:='SOFTWARE\Mozilla\Mozilla Thunderbird\'+S+'\Main';
if R.OpenKeyReadOnly(S) then
Result:=R.ReadString('PathToExe');
R.CloseKey;
end;
finally
R.Free;
end;
{$ENDIF}
{$ENDIF}
end;
function TEmailAppThunderbird.MakeParams: string;
begin
Result:='-compose "to='+FFilter.Email+','+
'subject='+FFilter.MessageSubject+','+
'attachment='+FFilter.EmailAttachFileName+','+
'body='''+Trim(FFilter.MessageBody.Text)+'''"';
{
Each message option follows the syntax field=value, for example:
to=foo@nowhere.net
subject=cool page
attachment=www.mozilla.org
attachment='file:///c:/test.txt'
body=check this page
Multiple message options are separated by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . Comma separators must not follow or precede spaces ( ). To assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" .
}
end;
class function TEmailAppThunderbird.AppName: string;
begin
Result:='Mozilla Thunderbird'
end;
initialization
RegisterEmailApp(TEmailAppThunderbird);
RegisterEmailApp(TEmailAppEvolution);
RegisterEmailApp(TEmailAppKMail);
end.
|