PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 24 → Wx - Envio de Email
Wx - Envio de Email
Débuté par adrianoboller, 03 aoû. 2015 17:35 - 2 réponses
Membre enregistré
2 969 messages
Popularité : +89 (91 votes)
Posté le 03 août 2015 - 17:35
//Wx - Envio de Email by Paulo Viana

//variaiveis
mensagem is Email
sessao is EmailSMTPSession
anexo is EmailAttach

//Send Mail - Teu email e Anexo
mensagem..Sender=minhaconta@Email.com.br
anexo..Name=sArquivoanexo ////arquivo anexo se houver
anexo..Content=fLoadText(anexo..Name)
Add(mensagem..Attach,anexo)

//Mensagem e Assunto
mensagem..HTML=TextToHTML(mensagememail) //// mensagem
mensagem..Subject=assuntoemail //// assunto
Add(mensagem..Recipient,destinatarioemail) //// acrescenta destinatario

//Servidor definições SMTP
sessao.ServerAddress=servidor
sessao.Port=porta
sessao.Option=emailOptionSecuredTLS ////em caso de segurança
sessao.Password=senha
sessao.Name=minhaconta@Email.com.br
EmailSetTimeOut(10)
HReset(tabemaillog)

//Mensagem de retorno
IF EmailStartSession(sessao) = False THEN
Info("erro")
ELSE
Info("sucesso")
END
EmailSendMessage(sessao,mensagem)
EmailCloseSession(sessao)
Posté le 11 août 2015 - 01:06
Posta mais detalhado com o form e tudo mais... assim ficou muito incompleto e não dá pra nos iniciantes aprender.
Membre enregistré
2 969 messages
Popularité : +89 (91 votes)
Posté le 15 août 2015 - 18:37
Prezado Jose,

Poderia se identificar com o nome completo Jose, em seu próximo post?

Segue exemplo completo conforme solicitou:

Na Tela seria mais ou menos assim:



Edt_Email: [jose@gmail.com ]
Edt_Destinatario: [adrianoboller@gmail.com ]
Edt_Path_Anexo: [c:\arquivo.pdf ]
Edt_Assunto: [Teste de envio de email ]
Edt_Mensagem:
===============================
||
||

===============================
[ENVIAR]


No Botao enviar teria esse codigo abaixo:

//Wx - Envio de Email by Paulo Viana

//Variaiveis
mensagem is Email
sessao is EmailSMTPSession
anexo is EmailAttach

//Send Mail - Teu email e Anexo
mensagem..Sender= Edt_email //minhaconta@Email.com.br
anexo..Name= Edt_Path_Anexo //arquivo anexo - c:\arquivo.pdf
anexo..Content=fLoadText(anexo..Name) //Carrega Arquivo
Add(mensagem..Attach,anexo) //atacha o anexo ao email

//Mensagem e Assunto
mensagem..HTML=TextToHTML(EDT_Mensagem) //// mensagem
mensagem..Subject= Edt_Assunto //// assunto
Add(mensagem..Recipient,EDT_Destinatario) //// acrescenta destinatario

//Servidor definições SMTP
sessao.ServerAddress="servidor" //mail.gmail.com
sessao.Port=porta //545
sessao.Option=emailOptionSecuredTLS ////em caso de segurança // True / False
sessao.Password="senha"
sessao.Name="minhaconta@Email.com.br"
EmailSetTimeOut(10)
HReset(tabemaillog)

//Mensagem de retorno
IF EmailStartSession(sessao) = False THEN
Info("erro")
ELSE
Info("sucesso")
END
EmailSendMessage(sessao,mensagem)
EmailCloseSession(sessao)


No caso de mobile use um webservice com DatabaseMail conforme exemplo que postei no Forum Oficial só procurar...
Mesmo sendo iniciante, é muito importante ler o manual completo da ferramenta
Tudo tem no Help, o link é esse aqui: help.windev.com


Email (Property)
..Email is used to find out and modify an email address.

Reading an email

Writing an email
Writing an email in WLanguage consists in filling the email structure of WLanguage...

Email (Type of variable)
The Email type is used to handle the content of an email as well as the associated information.

The email structure
The email structure is a preset structure of WLanguage (no declaration is required)...

Link control associated with an item containing an email address
In a database, the email address of the customers, suppliers, ...

EmailSend (Function)
Sends an email via the SMTP protocol while controlling the "buffer" of the email.

EmailCheckAddress (Function)
Checks the validity of an email address.

EmailLoadAttachment (Function)
Adds an attached file to an email.

EmailExpunge (Function)
Destroys all the deleted emails marked as deleted ("Deleted" status) from the current folder of an IMAP session.

EmailImportHTML (Function)
Imports, into the Email structure or into an Email variable, the content of an HTML file in order to send it by email.

EmailSeekFirst (Function)
Finds one or more emails according to the criteria specified in the messaging software (Outlook, messaging software using the IMAP protocol, ...).

EmailSendMessage (Function)
Sends an email according to the protocol used (SMTP, MS Exchange, Pocket Outlook, Lotus Notes, Outlook).

Check: Sending an email
The monitoring robot will ...

EmailChangeStatus (Function)
Changes the status of an email on a messaging server.

EmailGetAll (Function)
Retrieves all the emails found on a server.

EmailDeleteMessage (Function)
Used to delete the current email according to the current protocol (POP3, IMAP, MS Exchange, Pocket Outlook, Lotus Notes or Outlook messaging).

EmailCopy (Function)
Copies an email found in a directory to another directory of an IMAP server.

EmailSeekFirstNotes (Function)
Seeks one or more emails according to specified criteria, in a local or remote Lotus Notes or Domino database.

EmailReadLast (Function)
Reads the last incoming email according to the protocol used (POP3 or IMAP, MS Exchange 4, Lotus Notes or Outlook).

EmailReset (Function)
Re-initializes all the variables of the email structure or of an Email variable.

Communicating by emails
With Internet, new means of communication have been developed and more specifically communication by emails...

Managing the emails with the POP3/SMTP protocols
The POP3 and SMTP protocols are protocols for email management recognized by all the Internet Service Providers...

EmailBuildSource (Function)
Generates the source code of the outgoing email from the variables currently found in the email structure or in an Email variable.

EmailMsgError (Function)
Returns the message corresponding to the identifier of the error.


EmailImportSource (Function)
Fills an Email variable from the content of its ..Source property or the different variables of the email structure from the content of the Email.Source variable.

EmailGetIndicator (Function)
Retrieves the indicators defined on an email of an IMAP session.

EmailReadLastHeader (Function)
Reads the header of the last incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

EmailReadFirstHeader (Function)
Reads the header of the first incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

EmailStatus (Function)
Returns the status of an email sent via an SMTP session started in asynchronous mode.

EmailUpdate (Function)
Updates the messages of MS Exchange according to the email server.

EmailStartSession (Function)
Starts a session for email management according to the selected management mode (POP3, SMTP, IMAP, MS Exchange or Pocket Outlook).

EmailReadNext (Function)
Reads the incoming email found after the current email according to the protocol (POP3 or IMAP, MS Exchange 4, Lotus Notes or Outlook).

EmailReadFirst (Function)
Reads the first incoming email according to the protocol used (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).

EmailCloseSession (Function)
Closes a session for email management according to the selected mode (SMTP/POP3, MS Exchange, Pocket Outlook or Lotus Notes).

EmailSaveAttachment (Function)
Copies the file attached to the current email onto the user computer (locally).

EmailMessageLength (Function)
Calculates the size of the specified message (without loading the message).

EmailStartOutlookSession (Function)
Used to access the data handled by the Outlook messaging software (emails, contacts, groups of contacts, tasks, appointments and folders).

EmailReadMessage (Function)
Reads an incoming according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

Managing the emails with "Simple MAPI"
Simple MAPI (also called "Simple Mail API") is an API for email management used by the Microsoft applications and especially by the MS Exchange 4 client...

EmailReadPrevious (Function)
Reads the email found before the current email according to the protocol used (POP3 or IMAP, MS Exchange, Lotus Notes or Outlook).

Managing the emails with "CEMAPI": Other user accounts

EmailIMAPSession (Type of variable)
The EmailIMAPSession type is used to access a messaging server by using the IMAP protocol (Internet Access Message Protocol) in order to pick up the messages found on this server.

EmailPOP3Session (Type of variable)
The EmailPOP3Session type is used to access a messaging server by using the POP3 protocol (Post Office Protocol) in order to pick up the messages found on this server.

EmailStartNotesSession (Function)
Used to access the data handled by the Lotus Notes messaging software (emails, contacts, groups of contacts, tasks, appointments).

EmailReadPreviousHeader (Function)
Reads the header of the email found before the current email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

EmailReadNextHeader (Function)
Reads the header of the email found after the current email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

EmailReadMessageHeader (Function)
Reads the header of an incoming email according to the protocol used (POP3 or IMAP, Lotus Notes or Outlook).

EmailNbMessage (Function)
Returns the number of incoming messages currently found:

on the email server (POP3 protocol only).
in the Outlook messaging software.


EmailStartIMAPSession (Function)
Starts a session for receiving and reading the emails with the IMAP protocol.


EmailRunApp (Function)
Starts the native application for sending emails found on the current computer:

Computer running Windows,
Mobile device (Android, iPhone, iPad).


Functions for managing the emails
List of functions for managing the emails

EmailStartPOP3Session (Function)
Starts a session for receiving and reading the emails with the POP3 protocol.

EmailStartSMTPSession (Function)
Starts a session for sending emails with the SMTP protocol.

IMAP protocol
The IMAP protocol is a standard protocol for managing the emails...

PageToEmail (Function)
Emails the data found in a page currently displayed in the browser.

EmailProgressBar (Function)
Manages a progress bar when sending and receiving emails.

How to contact the Free Technical Support?
The different methods used to contact the Technical Support of PC SOFT.

GglAdWListClientAccount (Function)
Retrieves the list of primary email addresses for each account managed by the multi-account center.

EmailOpenMail (Function)
Opens the default messaging software:

of the Web user on the browser computer.
of the user on the current Windows computer.
on the phone.


Remote WebDev administrator: Personal information
The remote management tool is used to check and modify (if necessary) your personal information.

OutlookStartSession (Function)
Used to access the data handled by the Outlook messaging software (emails, contacts, groups of contacts, tasks, appointments and folders).

iParameterExport (Function)
Used to configure the exports performed from the print preview:

parameters for sending the emails.
parameters for creating the different files.


Accessing Outlook
WinDev and WebDev allow you to easily access the data handled by Outlook...

CloseSession (Function)
Closes a session with Lotus Notes or Outlook.

Constants for managing the emails
List of constants used by the functions for managing the emails.

Creating your own User Macro-Codes
The User Macro-Codes are sections of WLanguage code allowing the end user to customize his application...

Text control: Input or display masks
WinDev and WebDev propose two types of masks ...

Managing the certificates
Signing a file allows you to check later that the file has not been modified or altered since it was signed. The signature also enables you to check the identity of the issuer.

WebDev administrator: Advanced configuration
The "Advanced" tab is used to configure the advanced features at server level...

Transmitting elements to the Free Technical Support

Accessing Lotus Notes
WinDev and WinDev allow you to easily access the data handled by Lotus Notes (Domino database)...

Print preview: "Export" pane

Notifications of a HFSQL server
A server may encounter problems without any user (or developer) noticing anything.

For example:

a scheduled task may fail,
an automatic backup may fail,
a node may become inactive in a HFSQL cluster, ...


Choosing the action associated with the button (WebDev)
Regardless of the button type, you have the ability to associate an action with this button...


Managing the groups and users (HFSQL Client/Server)
To simplify the management of users and groups of users, the HFSQL Client/Server engine uses several variables allowing you to easily define the characteristics of the groups and users...

EmailReadLast (Example)
Example for using the EmailReadLast function

EmailReadPrevious (Example)
Example for using the EmailReadPrevious function

EmailSend (Example)
Example for using the EmailSend function

EmailCloseSession (Example)
Example for using the EmailCloseSession function

Cada Funcao jogue no FIND do help.windev.com

Esses são alguns tópicos que eu encontei sobre o assunto numa primeira pergunta se procurar no forum oficial encontra muitos exemplos sobre isso. Bons estudos...

Atenciosamente,

Adriano Boller