| |
|
|
Erasmus.Herold | Hello together.
over ands over again using I The Mail-function in XProfan. so correctly. pleased be I with the Opportunities never been. from this reason have I a Mail-procedure built, a unlimited amount on Dateianhängen allows.
When calling go Transmitter, Empfänger, Betreff and mehrzeiliger Text mitgegeben, moreover any Dateianhänge (too with way).
declare area#, len&, base64$
declare dateianhang_name$[], dateianhang_base64$[], z%, anzahl_anhaenge%
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PROZEDUREN
PROC MAIL_MIT_ANHAENGEN
Parameters from$, to$, subject$, Text$, attachment$
declare z%
z% = 1
anzahl_anhaenge% = 1
while (z% <= len(attachment$))
if (mid$(attachment$,z%,1) = "|")
INC anzahl_anhaenge%
endif
INC z%
endwhile
z% = 1
while (z% <= anzahl_anhaenge%)
dateianhang_name$[z%] = substr$(attachment$,z%,"|")
INC z%
endwhile
clearlist
// Beginn the Headers
addstring from$
addstring to$
addstring from$
addstring to$
addstring "Date: " + Date$(5)
addstring "Subject: " + subject$
addstring "Mime-Version: 1.0"
// boundary = The link between Message and attachment
addstring "Content-Type: multipart/mixed; boundary=\q22334466\q"
addstring "--22334466"' Beginn the Message
addstring "Content-Type: Text/plain; charset=\qiso-8859-1\q"
addstring "Content-Transfer-Encoding: quoted-printable"
addstring ""
addstring Text$
// ANHANG
z% = 1
while (z% <= anzahl_anhaenge%)
addstring "--22334466"
addstring "Content-Type: file/unknown; name=\q" + dateianhang_name$[z%] + "\q"
addstring "Content-Transfer-Encoding: base64"
addstring "Content-Disposition: attachment; filename=\q" + substr$(dateianhang_name$[z%],-1,"\") + "\q"
addstring ""
// Base64-String häppchenweise (apiece 72 characters) add
len& = FileSize(dateianhang_name$[z%])
Dim area#, len&
BlockRead(dateianhang_name$[z%], area#, 0, len&)
base64$ = encode64(char$(area#, 0, len&))
while len(base64$) > 72
addstring left$(base64$,72)
base64$ = del$(base64$,1,72)
endwhile
addstring base64$
'print "Dateiname: " + dateianhang_name$[z%]
'print "Base64: " + base64$
'print "Länge: " + st$(len&)
INC z%
endwhile
addstring ""
addstring "--22334466--"
ENDPROC
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// MAIL-VERSAND
// SYNTAX: MAIL_MIT_ANHAENGEN OF, AN, BETREFF, MAILTEXT_MIT_UMBRÜCHEN, DATEIANHÄNGE_MEHRERE_DURCH_PIPE_GETRENNT
MAIL_MIT_ANHAENGEN "absender@server.de", "empfänger@server.de", "Mail with Anhängen", "Hallo ...\n\nHier comes a\nMail with several\nAnhängen.\n\nEnde ...", "Emoji Smiley-05.png|Emoji Smiley-04.png|Emoji Smiley-01.png"
print smtp("SendRaw", "mail-server.de", "", "")
end
Perhaps is it too others helpful, me vereinfacht it whom Mail-Versand now very.
Greeting - Erasmus |
|
|
| |
|
|