Seite 4 von 6
Re: Mail-Lib - E-Mail versenden
Verfasst: 14.07.2012 18:50
von ts-soft
Mit einer fixen FileID in einer Userlib, typisch Droopy...
Mal sehen, wenn alles klappt werde ich morgen eine überarbeitete Version in der Tipps & Trickssektion posten.
Linux und Unicode sollten dann auch unterstützt werden, hoffe ich mal. Aber vor dem Release muss ich noch
etwas Gehirnschmalz investieren
Gruß
Thomas
Re: Mail-Lib - E-Mail versenden
Verfasst: 14.07.2012 19:25
von Nino
Ich denke, in diesem Zusammenhang ist auch folgendes Projekt von cptdark
http://forums.purebasic.com/german/view ... =8&t=23313
erwähnenswert.
Grüße, Nino
Re: Mail-Lib - E-Mail versenden
Verfasst: 20.07.2012 13:29
von Velz
ts-soft hat zwar schon eine Lösung gebaut, aber anbei der Link zu einem Tool das ich für den Mailversand mit auth verwende.
http://caspian.dotconf.net/menu/Software/SendEmail/
Das ist einfach ein Kommandozeilenprogramm dem ich Parameter übergebe. Gibt es für Linux und Windows.
Re: Mail-Lib - E-Mail versenden
Verfasst: 20.07.2012 13:51
von bobobo
kunstlust hat geschrieben:@TS-Soft
Es ist schon schade, das diese "Grundfunktion" in PB nicht drin ist, welcher Mailserver nimmt noch Mails ohne "SMTP-Auth" an.
[/code]
Es gibt durchaus lokale MailServer (*)(da fällt mir mal hMailServer zu ein)
die den Versand (und auch den Enpfang) für Dich erledigen können und
damit lässt sich prima mit PB kommunizieren über die
Pb-internen Spar-Mail-Möglichkeiten
(*) Das soll keine Empfehlung für den Normaluser sein. Ein Mailserver ist nicht ganz ohne
und lockt Ungeziefer an, wenn man den und das Umfeld falsch konfiguriert.
Re: Mail-Lib - E-Mail versenden
Verfasst: 03.09.2012 18:34
von kunstlust
ich habe mal versucht das aus dem VBS
http://www.paulsadowski.com/wsh/cdo.htm zu übernehmen, was mir aber nicht gelingt:
Code: Alles auswählen
XIncludeFile "COMatePLUS.pbi"
objMessage.COMateObject
objConfiguration.COMateObject
objMessage = COMate_CreateObject("CDO.Message")
objConfiguration = COMate_CreateObject("CDO.Configuration")
If objMessage
objMessage\GetStringProperty("Subject='Example CDO Message'")
objMessage\GetStringProperty("From='postmaster@test.de'")
objMessage\GetStringProperty("To='monster@ag.de'")
objMessage\GetStringProperty("HTMLBody='<h1>This is some sample message html.</h1>'")
;objMessage\SetStringProperty("Bcc='you@your.com'")
;objMessage\SetStringProperty("Cc='you2@your.com'")
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/sendusing"+Chr(41)+Chr(61) +"1"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/smtpserver"+Chr(41)+Chr(61) +"mail.mailserver.de"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"+Chr(41)+Chr(61) +"cdoBasic"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/sendusername"+Chr(41)+Chr(61) +"hamster@rad.de"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/sendpassword"+Chr(41)+Chr(61) +"password"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/smtpserverport"+Chr(41)+Chr(61) +"25"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/smtpusessl"+Chr(41)+Chr(61) +"True"+Chr(41))
objConfiguration\SetProperty ("Configuration\Fields\Item"+Chr(40)+"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"+Chr(41)+Chr(61) +"60"+Chr(41))
objConfiguration\SetProperty("Configuration\Fields\Update")
objMessage\invoke("Send")
Debug COMate_GetLastErrorDescription()
objMessage\Release()
EndIf
Irgenwie komme ich mit dem Zeichensetzen durcheinander.... Die Meldung ist immer "Der "SendUsing"-Konfigurationswert ist ungültig."
Aber der Ansatz könnte zu mindestens unter Windows helfen
Re: Mail-Lib - E-Mail versenden
Verfasst: 03.09.2012 20:08
von NicTheQuick
Ich hab damit noch nie was gemacht, aber sollte das nicht so heißen?
Code: Alles auswählen
objConfiguration\SetProperty("Configuration\Fields\Item(" + Chr(34) + "http://schemas.microsoft.com/cdo/configuration/sendusing" + Chr(34) + ")=1")
Das erscheint mir logischer. Zumal ich auch nicht verstehe, warum du die Klammern und das Gleichheitszeichen überhaupt mit Chr() kodiert hast.
Re: Mail-Lib - E-Mail versenden
Verfasst: 03.09.2012 21:56
von Kiffi
außerdem bringst Du GetStringProperty() und SetStringProperty()
durcheinander.
... und Fields\Update scheint mir eine Methode zu sein, die dann mit
Invoke() aufgerufen werden sollte.
Grüße ... Kiffi
Re: Mail-Lib - E-Mail versenden
Verfasst: 04.09.2012 14:46
von kunstlust
Ich habe es für meine Bedürfnisse gekürzt
http://forum.purebasic.com/english/view ... p?p=266648
Kern der Geschichte ist aber die nicht immer ganz einfache Schreibweise.
Code: Alles auswählen
XIncludeFile "COMatePLUS.pbi"
Define.COMateObject objemail,iconf,objbodypart,objbodypart1
objemail = COMate_CreateObject("CDO.Message")
iConf = COMate_CreateObject("CDO.Configuration")
ToAddress.s ="pb@mailserver.de"
SmtpServer.s = "mail.mailserver.de"
FromName.s="PB Mailtest"
FromAddress.s ="postmaster@mailserver.de"
replyto.s =""
Subject.s ="Test"
BodyHTML.s ="<h1>Ich bin eine Bodytext</h1>"
SmtpServer.s ="mein.mailserver.de"
Username.s="postmaster@mailserver.de"
Password.s="Geheim"
CcAddress.s
BccAddress.s
If objemail
objemail\SetProperty("Configuration="+ Str(iconf)+ " As COMateObject" )
objemail\SetProperty("MimeFormatted=1" )
objemail\SetProperty("to='"+ ToAddress +"'")
objemail\SetProperty("from='"+Chr(34)+ FromName + Chr(34)+ "<" + FromAddress + ">" +"'")
objemail\SetProperty("Subject='"+Subject+"'")
objemail\SetProperty(" HTMLBody="+"'"+BodyHTML+"'")
objemail\SetProperty("replyTo ='"+replyto+"'")
If CcAddress <> ""
objemail\SetProperty("Cc ='"+ CcAddress +"'")
EndIf
If BccAddress <> ""
objemail\SetProperty("Bcc ='"+ BccAddress +"'")
EndIf
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendusing') = 2" )
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpserver') =" +"'"+ SmtpServer+"'" )
If IPPort = 0
IPPort = 25
EndIf
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpserverport') ="+ Str(IPPort))
If Username <> ""
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate') =1")
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendusername') ="+ "'"+ Username+"'")
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendpassword') =" +"'"+ Password +"'" )
EndIf
If ssl
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpusessl') = 2" )
EndIf
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout') = 60")
objemail\Invoke("Configuration\Fields\Update")
objemail\invoke("Send")
Debug COMate_GetLastErrorDescription()
objemail\Release()
EndIf
Re: Mail-Lib - E-Mail versenden
Verfasst: 06.02.2014 15:35
von kunstlust
Hallo,
ich habe ein Problem mit dem Anhängen einer Datei, da ich nur unter Windows mailen möchte und Strato nun auf SSL umstellt, bin ich noch mal auf die CDO Methode gekommen, die Grundlage dafür ist auf folgender Seite zu finden
http://www.paulsadowski.com/wsh/cdo.htm. Soweit mir bekannt ist SSL in SendMail() von PB noch nicht möglich, ich habe noch ein paar andere Dinge probiert die in den Foren mit der cryptlib.dll laufen sollte, aber der Erfolg war mir nicht geben. Ich nutze die aktuelle PB 5.21 LTS.
Ohne Dateianhang läuft die Methode ja auch und ist ohne viel Aufwand, aber ein Attachment per 'objMessage.AddAttachment "c:\temp\readme.txt"' anzuhängen, klappt nicht
Hat jemand eine Idee woran es liegt?
Code: Alles auswählen
XIncludeFile "COMatePLUS.pbi"
Define.COMateObject objemail,iconf,objbodypart,objbodypart1
objemail = COMate_CreateObject("CDO.Message")
iConf = COMate_CreateObject("CDO.Configuration")
ToAddress.s ="an@mail.de"
SmtpServer.s = "smtp.strato.de"
FromName.s="PB Mailtest "
FromAddress.s ="von@mail.de"
replyto.s ="replay@mail.de"
Subject.s ="Testmail per CDO"
BodyHTML.s ="<h2>Ich bin der Bodytext</h2>"
IPPort.i = 465
ssl.b = 1
timeout.i = 60
Attachment.s = "c:\test.txt"
Username.s="username"
Password.s="passwort"
CcAddress.s
BccAddress.s
If objemail
objemail\SetProperty("Configuration="+ Str(iconf)+ " As COMateObject" )
objemail\SetProperty("MimeFormatted=1" )
objemail\SetProperty("to='"+ ToAddress +"'")
objemail\SetProperty("from='"+Chr(34)+ FromName + Chr(34)+ "<" + FromAddress + ">" +"'")
objemail\SetProperty("Subject='"+Subject+"'")
objemail\SetProperty("HTMLBody="+"'"+BodyHTML+"'")
objemail\SetProperty("replyTo ='"+replyto+"'")
objemail\SetProperty("AddAttachment"+Chr(34)+Attachment+Chr(34)); eigentlich sollte das so OK sein, es kommt aber nichts an....
If CcAddress <> ""
objemail\SetProperty("Cc ='"+ CcAddress +"'")
EndIf
If BccAddress <> ""
objemail\SetProperty("Bcc ='"+ BccAddress +"'")
EndIf
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendusing') = 2" )
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpserver') =" +"'"+ SmtpServer+"'" )
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpserverport') ="+IPPort)
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpauthenticate') =1")
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendusername') ="+ "'"+ Username+"'")
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/sendpassword') =" +"'"+ Password +"'" )
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpusessl') ="+ssl)
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout') ="+timeout)
Delay(50)
objemail\Invoke("Configuration\Fields\Update")
objemail\invoke("Send")
Debug COMate_GetLastErrorDescription()
objemail\Release()
EndIf
Re: Mail-Lib - E-Mail versenden
Verfasst: 07.02.2014 14:52
von bobobo
Keine Idee
Aaaber .. ich habe relativ oft Erfolg (*)mit dem Mailversand per SSL
wenn ich die "normale" Sendmail.lib von PB (ab 5.1 , die mit Auth-Unterstützung)
benutze und das per
stunnel weiterleite.
(*) 1und1 und gmx geht, t-online und g4w , wenn man in der stunnel-Konfig das protocol smtp mit angibt