Seite 1 von 2
E-mail versenden
Verfasst: 26.10.2004 22:10
von opera.v
Hi, ich hab mich jetzt einmal durchgerungen und die PureBasic demo heruntergeladen, das heißt, ich kenn mich noch nicht wirklich aus, hab aber schon etwas erfahrung in sachen programmierung von Delphi.
Jetzt wollte ich mal versuchen ein Programm zu schreiben, dass einfach die Eingabe in ein Textfeld als E-mail an meine E-mailadresse schickt.
Ich hab schon die Forumsuche benutzt und dort was von Blat gelesen und gleich runtergeladen, leider blick ich da aber nicht ganz durch, kann mir jemand hier weiterhelfen?
Also wie ich Blat zum Benutzen kann oder eine alternative Möglichkeit?
Verfasst: 27.10.2004 15:12
von wichtel
mit blat:
blat.dll runterladen von:
http://www.geocities.com/toby_korn/blat/
im code die parameter anpassen und los gehts.
Code: Alles auswählen
;smtp parameter
mailto$ ="Adressat@wasweisich.net"
subject$ ="das ist ein blat test"
mailfrom$ ="Absender@woauchimmer.net"
attach$ ="bild.jpg
smtphost$ ="smtp.dein-isp.com
smtpport$ ="25"
authuser$ =""
authpasswd$=""
;-message body und blat parameter
body$="This is a test."+Chr(13)
body$+"Without a text file, all from within PureBasic<br>"
body$+"Multiline and HTML format<br>"
body$+"<font color=red>And color support</font><br>"
blat$="-"
blat$+" -to "+mailto$
blat$+" -subject "+Chr(34)+subject$+Chr(34)
blat$+" -f "+mailfrom$
blat$+" -body "+Chr(34)+body$+Chr(34)
If attach$
blat$+" -attach "+attach$
EndIf
blat$+" -server "+smtphost$
blat$+" -port "+smtpport$
blat$+" -noh2"
blat$+" -q"
blat$+" -html"
If authuser$ And authpasswd$
blat$+" -u "+authuser$
blat$+" -pw "+authpasswd$
blat$+" -plain"
EndIf
Debug blat$
;- mit normaler dll
#blat=0
blat=OpenLibrary(#blat,"blat.dll")
Debug blat
ret=IsFunction(#blat,"Send")
Debug ret
ret=CallFunction(#blat,"Send",blat$)
End
;- blat Hilfe
; Blat v1.9.4: WinNT/95 console utility To mail a file via SMTP
; by P.Mendes, M.Neal, G.Vollant, T. Charron
; http://www.blat.net
; syntax:
; Blat <filename> -To <recipient> [optional switches (see below)]
; Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q]
; Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q]
; Blat -h [-q]
;
; -install <server addr> <sender's addr> [<try n times> [<port> [<profile>]]]
; : set's SMTP server, sender, number of tries and port for profile
; (<try n times> And <port> may be replaced by '-').
;
; <filename> : file with the Message body ('-' For console input, End with ^Z)
;
; -To <recipient> : recipient list (also -T) (comma separated)
; -tf <recipient> : recipient list filename
; -subject <subj>: subject Line (also -s)
; -f <sender> : overrides the Default sender address (must be known To server)
; -i <addr> : a 'From:' address, not necessarily known To the SMTP server.
; -cc <recipient>: carbon copy recipient list (also -c) (comma separated)
; -cf <file> : cc recipient list filename
; -bcc <recipient>: blind carbon copy recipient list (also -bcc) (comma separated)
;
; -bf <file> : bcc recipient list filename
; -organization <organization>: organization field (also -o And -org)
; -body <text> : Message body
; -x <x-Header: detail>: Custom 'X-' Header. eg: -x "X-INFO: Blat is Great!"
; -r : Request Return receipt.
; -d : Request disposition notification.
; -h : displays this help.
; -q : supresses *all* output.
; -Debug : Echoes server communications To screen (disables '-q').
; -noh : prevent x-Mailer Header from showing homepage of Blat
; -noh2 : prevent x-Mailer Header entirely
; -P <profile> : send with SMTP server, user And port defined in <profile>.
; -priority <pr> : set Message priority 0 For low, 1 For high.
; -server <addr> : Specify SMTP server To be used. (optionally, addr:port)
; -port <port> : port To be used on the server, defaults To SMTP (25)
; -hostname <hst>: Select the hostname used To send the Message
; -mime : mime Quoted-Printable Content-Transfer-Encoding.
; -enriched : send an enriched text message (Content-Type=text/enriched)
; -html : send an html message (Content-Type=text/html)
; -uuencode : Send (binary) file UUEncoded
; -base64 : Send (binary) file using base64 (binary mime)
; -try <n times> : how many time Blat should try To send. from '1' To 'INFINITE'
; -attach <file> : attach binary file To message (may be repeated)
; -attacht <file>: attach text file To message (may be repeated)
; -ti <n> : set timeout To 'n' seconds.
; -u <username> : username For AUTH LOGIN (use with -pw)
; -pw <password> : password For AUTH LOGIN (use with -u)
; -log <filename>: log everything but usage To <filname>
; -plain : use AUTH plain To login To SMTP server (use with -u -pw)
; -charset <cs> : user defined charset. the Default is ISO-8859-1
;
; Note that If the '-i' option is used, <sender> is included in 'Reply-to:'
; And 'Sender:' fields in the Header of the Message.
;
; optionally, the following options can be used instead of the -f And -i
; options:
;
; -mailfrom <addr> the RFC 821 mail from: statement
; -from <addr> the RFC 822 from: statement
; -replyto <addr> the RFC 822 Reply-To: statement
; -returnpath <addr> the RFC 822 Return-Path: statement
; -sender <addr> the RFC 822 sender: statement
;
; For backward consistency, the -f And -i options have precedence over these
; RFC 822 defined options. If both -f And -i options are omitted then the
; RFC 821 mail from statement will be defaulted To use the installation-defined
; Default sender address
;
;
Alternative kannst du auch selbst dein SMTP connect bauen. Schau mal im archiv nach unter sendmail.
Verfasst: 27.10.2004 18:09
von opera.v
danke erstmal, dass heißt, ich schreib jetzt dass in meinen Code
Code: Alles auswählen
;smtp parameter
mailto$ ="Adressat@wasweisich.net"
subject$ ="das ist ein blat test"
mailfrom$ ="Absender@woauchimmer.net"
attach$ ="bild.jpg
smtphost$ ="smtp.dein-isp.com
smtpport$ ="25"
authuser$ =""
authpasswd$=""
;-message body und blat parameter
body$="This is a test."+Chr(13)
body$+"Without a text file, all from within PureBasic<br>"
body$+"Multiline and HTML format<br>"
body$+"<font color=red>And color support</font><br>"
blat$="-"
blat$+" -to "+mailto$
blat$+" -subject "+Chr(34)+subject$+Chr(34)
blat$+" -f "+mailfrom$
blat$+" -body "+Chr(34)+body$+Chr(34)
If attach$
blat$+" -attach "+attach$
EndIf
blat$+" -server "+smtphost$
blat$+" -port "+smtpport$
blat$+" -noh2"
blat$+" -q"
blat$+" -html"
If authuser$ And authpasswd$
blat$+" -u "+authuser$
blat$+" -pw "+authpasswd$
blat$+" -plain"
EndIf
Debug blat$
;- mit normaler dll
#blat=0
blat=OpenLibrary(#blat,"blat.dll")
Debug blat
ret=IsFunction(#blat,"Send")
Debug ret
ret=CallFunction(#blat,"Send",blat$)
End
Und pass es dan mit meinen Daten an?
Und muss ich am Anfang auch sowas wie include #blat oder so schreiben?
Verfasst: 27.10.2004 18:15
von opera.v
DANKE DANKE DANKE..es geht

und es ist einfacher als ich dachte..danke nochmal

Verfasst: 27.10.2004 18:18
von wichtel
nein, du musst nur die blat.dll in den gleichen Ordner wie dein Program kopieren. (auch zur Laufzeit)
Sollte einfach funktionieren.
Einfache Text Nachrichten kann man auch prima mit einer selbst gestrickten SMTP routine verschicken.
Aber mails miz attachements, im HTML Format usw. habe ich bisher nur mit blat richtig gut erreicht.
edit:
oops, das hat sich wohl zeitlich überschitten.
Verfasst: 27.10.2004 19:57
von pvmichael
Na wenn das nicht wieder was geniales fürs Codearchiv ist

Verfasst: 27.10.2004 21:51
von opera.v
eine Frage hab ich dann noch:
Wenn ich jetzt mein E-mail Passwort im Code stehen habe und dass zu einer Exe Compiliere, gibt es dann die Möglichkeit man Passwort direkt über die Exe herauszufinden, bzw, wie schwer wäre es, weil wenn das nur irgendein paar totale Profis können is mir das Wurscht, aber wenn es da eine idiotensicherere Variante gibt wäre das natürlich blöd...
Verfasst: 27.10.2004 22:40
von wichtel
die exe ist komprimiert, ein einfacher hex editor tut es nicht.
Aber man kommt an die strings schon ran.
Wenn es nicht wasserdicht sein soll, dann verschlüssel doch dein Kennwort primitiv durch ein paar bitshifts oder die in PB vorhandenen crypt Funktionen und baue es erst zur Laufzeit zusammen.
Da muss dann schon ein Profi ran um es zu knacken.
Gruß
Verfasst: 28.10.2004 10:03
von stbi
opera.v hat geschrieben:eine Frage hab ich dann noch:
Wenn ich jetzt mein E-mail Passwort im Code stehen habe und dass zu einer Exe Compiliere, gibt es dann die Möglichkeit man Passwort direkt über die Exe herauszufinden, bzw, wie schwer wäre es, weil wenn das nur irgendein paar totale Profis können is mir das Wurscht, aber wenn es da eine idiotensicherere Variante gibt wäre das natürlich blöd...
gib Dir keine Mühe, Dein Rechner versendet das Passwort ohnehin im Klartext übers Internet ...
Verfasst: 28.10.2004 10:07
von pvmichael

Warum hab ich da nicht dran gedacht
