Árvore de páginas

Indica o endereço de e-mail que será exibido na mensagem como tendo enviado a mesma.

Tipo

Valor Padrão

Somente Leitura

caractere

""

N

Observações

  • Alguns servidores de e-mail (como o GMail) não permitem que o remetente da mensagem seja alterado, mesmo tendo recebido o comando para isso.

Exemplos

user function teste()
  Local oServer
  Local oMessage
  Local xRet
  
  //Create connection with SMTP server ( E-mail sending )
  oServer := TMailManager():New()
  oServer:SetUseTLS( .T. )
  oServer:SetUseSSL( .T. )
  xRet := oServer:Init( "", "smtp.myserver.com", "[email protected]", "mypassword", , 587 )
  if xRet != 0
    conout( "Error on Init: " + oServer:GetErrorString( xRet ) )
    return .F.
  endif
  
  //Set sending timeout to 1 minute
  xRet := oServer:SetSMTPTimeOut( 60 )
  if xRet != 0
    conout( "Error setting timeout: " + oServer:GetErrorString( xRet ) )
    return .F.
  endif
  
  //Establish SMTP connection
  xRet := oServer:SMTPConnect()
  if xRet != 0
    conout( "Error on connecting: " + oServer:GetErrorString( xRet ) )
    return .F.
  endIf
  
  xRet := oServer:SMTPAuth( "[email protected]", "mypassword" )
  if xRet != 0
    Conout( "Error on authentication: " + oServer:GetErrorString( xRet ) )
    Return .F.
  endif
  
  //After the connection, creates message object
  oMessage := TMailMessage():New()
  
  //Clean the object
  oMessage:Clear()
  
  //Populate the sending data
  oMessage:cFrom    := "[email protected]"
  oMessage:cTo      := "[email protected]"
  oMessage:cCc      := ""
  oMessage:cBcc     := ""
  oMessage:cSubject := "Teste de Email"
  oMessage:cBody    := "Conteudo do e-mail"
  
  //Send the e-mail
  xRet := oMessage:Send( oServer )
  if xRet != 0
    Conout( "Error sending e-mail: " + oServer:GetErrorString( xRet ) )
    Return .F.
  endif
  
  //Disconnect from server
  xRet := oServer:SmtpDisconnect()
  if xRet != 0
    Conout( "Error disconnecting from SMTP server: " + oServer:GetErrorString( xRet ) )
    Return .F.
  endif
return .T.
  • Sem rótulos