PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → [WD5.5] sending e-mail
[WD5.5] sending e-mail
Iniciado por Patrick Vandebroek, fev., 17 2004 1:13 PM - 2 respostas
Publicado em fevereiro, 17 2004 - 1:13 PM
Hi,
when I want to send e-mails within windev I use the following code:
username is string
USER is string = "user"
Password is string = "pasw"
serverpop is string = "pop.tiscali.be"
serversmtp is string = "smtp.tiscali.be"
portP is int = 110
ports is int = 25
bOK is long int
if (EmailStartSession(USER,PASSWORD,SERVERpop,serversmtp,portP,portS))
UserName=USER
// Initialize mail components
// The sender (session user) is required to send the message
Email.Sender=""
// Recipients
Email.Recipient[1]=""
Email.NbRecipient=1
Email.Subject="TEST" // Message topic
Email.Message="Dit is een test van windev email" // Message text
Email.Nbattach=0 // Links
// Send the mail
If not EMailSendMessage(UserName)
Error(EmailMsgError(Email.Error))
End
Else
UserName=""
Error("Unable to connect")
End
emailclosesession(username)
This works fine, but you must know the email.sender, pop3 and smtp.
Does anyone know if you can get the email address of the sender, the pop3 and smtp by api call or any other way?
This program must run by clients and I don't wont to let them give in this information manually.
I know that this information must be stored in windows register, but how to get it?
Regards,
Patrick
Publicado em fevereiro, 17 2004 - 10:15 PM
Hi,
This works fine, but you must know the email.sender, pop3 and smtp.
Does anyone know if you can get the email address of the sender, the
pop3 and smtp by api call or any other way?

Hm, dont think that's possible. If you are sure only MS
products are used (OE ...) with pop/smtp then you can have a
look at 'HKEY_CURRENT_USER\Software\Microsoft\Internet Account
Manager' but normally it depends on emailclient etc etc.
Put this values in your own config file, normally client knows
and if not then no email ;-).
--
Peter


http://www.xs4all.nl/~petervu
Publicado em fevereiro, 18 2004 - 9:21 AM
Hi Peter,
Thnx for helping me out.
For the one who are interested in this, this is the result:
username is string
USER is string
Password is string
serverpop is string
serversmtp is string
portP is int = 110
ports is int = 25
bOK is long int
path is string
email is string
stop
path = "HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\00000001"
user = RegistryQueryValue(path,"POP3 User Name")
password = RegistryQueryValue(path,"POP3 Password2")
password = hextostring(password,length(password))
serverpop = RegistryQueryValue(path,"POP3 Server")
serversmtp = RegistryQueryValue(path,"SMTP Server")
portP = RegistryQueryValue(path,"POP3 Port")
portS = RegistryQueryValue(path,"SMTP Port")
email = RegistryQueryValue(path,"SMTP Email Address")

//Server is string = NetIPAddress("pop.tiscali.be")
if (EmailStartSession(USER,PASSWORD,SERVERpop,serversmtp,portP,portS))
UserName=USER
// Initialize mail components
// The sender (session user) is required to send the message
Email.Sender="<" + email + ">"
// Recipients
Email.Recipient[1]=""
Email.NbRecipient=1
Email.Subject="TEST" // Message topic
Email.Message="Dit is een test van windev email" // Message text
Email.Nbattach=0 // Links
// Send the mail
If not EMailSendMessage(UserName)
Error(EmailMsgError(Email.Error))
End
Else
UserName=""
Error("Unable to connect")
End
emailclosesession(username)
This code works fine if you let the user manually fill in the password.
I'm writing a procedure to get the password from the registry, but no luck so far .
If someone has a function to get the password from a binary value, it would help a lot.
Regards,
Patrick