Página 1 de 9
Email pelo Harbour
Enviado: 05 Mai 2009 08:52
por Itamar M. Lins Jr.
Ola!
Não consegui ainda enviar email.
Tenho conta no yahoo, gmail, boll. Em nenhum deles consegui enviar email.
Meu email é
itamarlins@gmail.com
Como faço para mandar uma email para
pedrojose@provedor.com ?
Quando mandamos o email vai por smtp ou pop ?
De diversas maneiras não estou conseguindo.
Código: Selecionar todos
***************************
Function ENVIA_ERRO(aARQUI)
***************************
local cSubject := "Erro do Sistema"
local aTo := { "itamarmlj@yahoo.com.br" }
local cServerIp := "smtp.gmail.com"
Local cFrom := "itamarlins@gmail.com"
Local cUser := "itamarlins"
Local aFiles := {aARQUI}
Local nPort := 465 //993 gmail imap //587 //YAHOO //gmail 465
Local cSenha := "abcdefgh"
Local cMsg := " Erro do sistema "
Local cPopServer := "pop.gmail.com:465"
Local lRead := .f.
Local lTrace := .T.
Local lPOPAuth := .T.
Local lNoAuth := .T.
IF VerificaNet() // testa a conexão com a internet
PRIVATE oDlgHabla:=NIL
MsgRun("Aguarde enviando o Erro")
// msginfo(
IF hb_SendMail(cServerIP,nPort,cFrom,aTo, , , cMsg,cSubject, aFiles, cUser , cSenha, cPopServer, 3 , lRead, lTrace,lPOPAuth,lNoAuth)
Saudações,
Itamar M. Lins Jr.
Re: Email pelo Harbour
Enviado: 05 Mai 2009 09:02
por Maligno
O envio de eMail é por servidor SMTP. No caso do GMail, o envio deve ser autenticado por SSL (o POP deles é por SSL também), o que implica numa conexão segura e o uso de porta especial (465 ou 587 pra SMTP e 995 para POP3) ao invés da tradicional porta 25 para SMTP ou 110 para POP3.
Observe que alguns provedores de acesso não permitem o envio de eMail por qualquer outro servidor que não o deles. Pode ser o seu caso. É, por exemplo, o meu caso. Não posso enviar eMail por nenhum outro servidor (medida anti-SPAM).
Re: Email pelo Harbour
Enviado: 05 Mai 2009 13:29
por gilbertosilverio
Ola Itamar,
Consigo enviar e-mail pela yahoo desta maneira...
Código: Selecionar todos
Function ENVIA_EMAIL()
LOCAL oSmtp, oEMail
LOCAL cSmtpUrl
LOCAL cSubject, cFrom, cTo, cBody, cFile
cSmtpUrl := "smtp://MEUEMAIL:SENHA@smtp.mail.yahoo.com.br"
cFrom := "MEUEMAIL@yahoo.com.br"
cTo := "EMAILDESTINO@ymail.com"
cSubject := [Envio de erro]
cFile := NIL //cNOME
cBody := [Envio de erro]
oEMail := TIpMail():new()
oEMail:setHeader( cSubject, cFrom, cTo )
oEMail:setBody( cBody )
oEMail:attachFile( cFile )
// oEMail:hHeaders[ "Disposition-Notification-To" ] := cFrom // solicita confirmacao de recebimento
oSmtp := TIpClientSmtp():new( cSmtpUrl )
IF oSmtp:open()
oSmtp:sendMail( oEMail )
oSmtp:close()
MSGINFO( [E-Mail enviado com sucesso] )
ELSE
fim_run()
MSGINFO( "Erro:", oSmtp:lastErrorMessage() )
ENDIF
RETURN Nil
Re: Email pelo Harbour
Enviado: 05 Mai 2009 19:28
por Itamar M. Lins Jr.
Ola! Gilberto.
Como ele sabe qual é a porta ?
Cada serviço desse, usa numeros diferentes.
O yahoo é 587 o gmail é 465 etc...
Mas irei testar dessa maneira novamente.
Valeu!
Saudações,
Itamar M. Lins Jr.
Re: Email pelo Harbour
Enviado: 05 Mai 2009 21:49
por gilbertosilverio
Itamar,
No meu outlook o smtp da yahoo e 25.
Mesmo o um novo email que criei da ymail, tambem envia como 25.
Re: Email pelo Harbour
Enviado: 05 Mai 2009 22:15
por asimoes
Olá Gilberto,
O exemplo abaixo funciona comigo.
Código: Selecionar todos
cServerIP:="smtp.mail.yahoo.com.br"
nPort :=25
cFrom :="seu_email@yahoo.com.br"
aTo :={"para@provedor.com.br"}
cCorpoMsg:="Arquivos de Sistema - Data: "+Trans(Date(),"@D")
cAssunto :="Arquivos de Sistema - Data: "+DToC(Date())
cUser :="seu_email"
cPass :="senha"
cPop :="pop.mail.yahoo.com.br"
lVar:=HB_SendMail(cServerIP,nPort,cFrom,aTo,,,cCorpoMsg,cAssunto,aArqEmail,cUser,cPass,cPop,1,.F.,.F.,.T.,)
If lVar
cVar:="Envio Ok"
Else
cVar:="Erro no Envio"
EndIf
Alert(cVar)
[]´s
Código do hb_sendmail:
Código: Selecionar todos
#include "common.ch"
FUNCTION HB_SendMail( cServer, nPort, cFrom, aTo, aCC, aBCC, cBody, cSubject, aFiles, cUser, cPass, cPopServer, nPriority, lRead, lTrace, lPopAuth)
/*
cServer -> Required. IP or Domain name of the mail server
nPort -> Optional. Port used my email server
cFrom -> Required. Email address of the sender
aTo -> Required. Character String or array of email addresses to send the email to
aCC -> Optional. Character String or array of email adresses for CC (Carbon Copy)
aBCC -> Optional. Character String or array of email adresses for BCC (BLind Carbon Copy)
cBody -> Optional. The body Message of the email as text, or the Filename of the HTML Message to send.
cSubject -> Optional. Subject of the sending email
aFiles -> Optional. Array of attachments to the email to send
cUser -> Required. User name for the POP3 server
cPass -> Required. Password for cUser
cPopServer -> Required. Pop3 server name or address
nPriority -> Optional. Email priority: 1=High, 3=Normal (Standard), 5=Low
lRead -> Optional. If Set to .T., a Confirmation request is send. Standard Setting is .F.
lTrace -> Optional. If Set to .T., a log File is created (sendmail<nNr>.log). Standard Setting is .F.
*/
LOCAL oInMail, cBodyTemp, oUrl, oMail, oAttach, aThisFile, cFile, cFname, cFext, cData, oUrl1
LOCAL cTmp :=""
LOCAL cMimeText := ""
LOCAL cTo := ""
LOCAL cCC := ""
LOCAL cBCC := ""
LOCAL lConnectPlain := .F.
LOCAL lRETURN := .T.
LOCAL lAuthLogin := .F.
LOCAL lAuthPlain := .F.
LOCAL lConnect := .T.
LOCAL oPop
DEFAULT cUser TO ""
DEFAULT cPass TO ""
DEFAULT nPort TO 25
DEFAULT aFiles TO {}
DEFAULT nPriority TO 3
DEFAULT lRead TO .F.
DEFAULT lTrace TO .F.
DEFAULT lPopAuth to .T.
cUser := StrTran( cUser, "@", "&at;" )
If !( (".htm" IN Lower( cBody ) .Or. ".html" IN Lower( cBody ) ) .And. File(cBody) )
If Right(cBody,2) != HB_OSNewLine()
cBody += HB_OsNewLine()
EndIf
EndIf
// cTo
If Valtype( aTo ) == "A"
If Len( aTo ) > 1
FOR EACH cTo IN aTo
If HB_EnumIndex() != 1
cTmp += cTo + ","
EndIf
NEXT
cTmp := SubStr( cTmp, 1, Len( cTmp ) - 1 )
EndIf
cTo := aTo[ 1 ]
If Len( cTmp ) > 0
cTo += "," + cTmp
EndIf
Else
cTo := AllTrim( aTo )
EndIf
// CC (Carbon Copy)
If Valtype(aCC) =="A"
If Len(aCC) >0
FOR EACH cTmp IN aCC
cCC += cTmp + ","
NEXT
cCC := SubStr( cCC, 1, Len( cCC ) - 1 )
EndIf
ElseIf Valtype(aCC) =="C"
cCC := AllTrim( aCC )
EndIf
// BCC (BLind Carbon Copy)
If Valtype(aBCC) =="A"
If Len(aBCC)>0
FOR EACH cTmp IN aBCC
cBCC += cTmp + ","
NEXT
cBCC := SubStr( cBCC, 1, Len( cBCC ) - 1 )
EndIf
ElseIf Valtype(aBCC) =="C"
cBCC := AllTrim( aBCC )
EndIf
If cPopServer != NIL .And. lPopAuth
Try
oUrl1 := tUrl():New( "pop://" + cUser + ":" + cPass + "@" + cPopServer + "/" )
oUrl1:cUseRid := Strtran( cUser, "&at;", "@" )
opop:= tIPClientPOP():New( oUrl1, lTrace )
If oPop:Open()
oPop:Close()
EndIf
Catch
lRETURN := .F.
END
EndIf
If !lRETURN
RETURN .F.
EndIf
TRY
oUrl := tUrl():New( "smtp://" + cUser + "@" + cServer + '/' + cTo )
CATCH
lRETURN := .F.
END
If !lRETURN
RETURN .F.
EndIf
oUrl:nPort := nPort
oUrl:cUseRid := cUser
oMail := tipMail():new()
oAttach := tipMail():new()
oAttach:SetEncoder( "7-bit" )
If (".htm" IN Lower( cBody ) .Or. ".html" IN Lower( cBody ) ) .And. File(cBody)
cMimeText := "text/html ; charSet=ISO-8859-1"
oAttach:hHeaders[ "Content-Type" ] := cMimeText
cBodyTemp := cBody
cBody := MemoRead( cBodyTemp ) + Chr( 13 ) + Chr( 10 )
Else
oMail:hHeaders[ "Content-Type" ] := "text/plain; charSet=iso8851"
EndIf
oAttach:SetBody( cBody )
oMail:Attach( oAttach )
oUrl:cFile := cTo + If( Empty(cCC), "", "," + cCC ) + If( Empty(cBCC), "", "," + cBCC)
oMail:hHeaders[ "Date" ] := tip_Timestamp()
oMail:hHeaders[ "From" ] := cFrom
If !Empty(cCC)
oMail:hHeaders[ "Cc" ] := cCC
EndIf
If !Empty(cBCC)
oMail:hHeaders[ "Bcc" ] := cBCC
EndIf
TRY
oInmail := tIPClientSMTP():New( oUrl, lTrace)
CATCH
lRETURN := .F.
END
If !lRETURN
RETURN .F.
EndIf
//oInmail:nConnTimeout:=20000
oInmail:nConnTimeout:=1000
If oInMail:Opensecure()
While .T.
oInMail:GetOk()
If oInMail:cReply == NIL
Exit
ElseIf "LOGIN" IN oInMail:cReply
lAuthLogin := .T.
ElseIf "PLAIN" IN oInMail:cReply
lAuthPlain := .T.
EndIf
EndDo
If lAuthLogin
If !oInMail:Auth( cUser, cPass )
lConnect := .F.
Else
lConnectPlain := .T.
EndIf
EndIf
If lAuthPlain .And. !lConnect
If !oInMail:AuthPlain( cUser, cPass )
lConnect := .F.
EndIf
Else
If !lConnectPlain
oInmail:Getok()
lConnect := .F.
EndIf
EndIf
Else
lConnect := .F.
EndIf
If !lConnect
oInMail:Close()
If !oInMail:Open()
lConnect := .F.
oInmail:Close()
RETURN .F.
EndIf
While .T.
oInMail:GetOk()
If oInMail:cReply == NIL
Exit
EndIf
EndDo
EndIf
oInMail:oUrl:cUseRid := cFrom
oMail:hHeaders[ "To" ] := cTo
oMail:hHeaders[ "Subject" ] := cSubject
FOR EACH aThisFile IN AFiles
If Valtype( aThisFile ) == "C"
cFile := aThisFile
cData := Memoread( cFile ) + Chr( 13 ) + Chr( 10 )
ElseIf Valtype( aThisFile ) == "A" .And. Len( aThisFile ) >= 2
cFile := aThisFile[ 1 ]
cData := aThisFile[ 2 ] + Chr( 13 ) + Chr( 10 )
Else
lRETURN := .F.
Exit
EndIf
oAttach := TipMail():New()
HB_FNameSplit( cFile,, @cFname, @cFext )
If Lower( cFile ) LIKE ".+\.(vbd|asn|asz|asd|pqi|tsp|exe|sml|ofml)" .Or. ;
Lower( cFile ) LIKE ".+\.(pfr|frl|spl|gz||stk|ips|ptlk|hqx|mbd)" .Or. ;
Lower( cFile ) LIKE ".+\.(mfp|pot|pps|ppt|ppz|Doc|n2p|bin|class)" .Or. ;
Lower( cFile ) LIKE ".+\.(lha|lzh|lzx|dbf|cdx|dbt|fpt|ntx|oda)" .Or. ;
Lower( cFile ) LIKE ".+\.(axs|zpa|pdf|ai|eps|ps|shw|qrt|rtc|rtf)" .Or. ;
Lower( cFile ) LIKE ".+\.(smp|dst|talk|tbk|vmd|vmf|wri|wid|rrf)" .Or. ;
Lower( cFile ) LIKE ".+\.(wis|ins|tmv|arj|asp|aabaam|aas|bcpio)" .Or. ;
Lower( cFile ) LIKE ".+\.(vcd|chat|cnc|coda|page|z|con|cpio|pqf)" .Or. ;
Lower( cFile ) LIKE ".+\.(csh|cu|csm|dcr|dir|dxr|swa|dvi|evy|ebk)" .Or. ;
Lower( cFile ) LIKE ".+\.(gtar|hdf|map|phtml|php3|ica|ipx|ips|js)" .Or. ;
Lower( cFile ) LIKE ".+\.(latex|bin|mIf|mpl|mpire|adr|wlt|nc|cdf)" .Or. ;
Lower( cFile ) LIKE ".+\.(npx|nsc|pgp|css|sh||shar|swf|spr|sprite)" .Or. ;
Lower( cFile ) LIKE ".+\.(sit|sca|sv4cpio|sv4crc|tar|tcl|tex)" .Or. ;
Lower( cFile ) LIKE ".+\.(texinfo|texi|tlk|t|tr|roff|man|mems)" .Or. ;
Lower( cFile ) LIKE ".+\.(alt|che|ustar|src|xls|xlt|zip|au|snd)" .Or. ;
Lower( cFile ) LIKE ".+\.(es|gsm|gsd|rmf|tsi|vox|wtx|aIf|aIff)" .Or. ;
Lower( cFile ) LIKE ".+\.(aIfc|cht|dus|mid|midi|mp3|mp2|m3u|ram)" .Or. ;
Lower( cFile ) LIKE ".+\.(ra|rpm|Stream|rmf|vqf|vql|vqe|wav|wtx)" .Or. ;
Lower( cFile ) LIKE ".+\.(mol|pdb|dwf|ivr|cod|cpi|FIf|gIf|ief)" .Or. ;
Lower( cFile ) LIKE ".+\.(jpeg|jpg|jpe|rip|svh|tIff|tIf|mcf|svf)" .Or. ;
Lower( cFile ) LIKE ".+\.(dwg|dxf|wi|ras|etf|fpx|fh5|fh4|fhc|dsf)" .Or. ;
Lower( cFile ) LIKE ".+\.(pnm|pbm|pgm|ppm|rgb|xbm|xpm|xwd|dig)" .Or. ;
Lower( cFile ) LIKE ".+\.(push|wan|waf||afl|mpeg|mpg|mpe|qt|mov)" .Or. ;
Lower( cFile ) LIKE ".+\.(viv|vivo|asf|asx|avi|movie|vgm|vgx)" .Or. ;
Lower( cFile ) LIKE ".+\.(xdr|vgp|vts|vtts|3dmf|3dm|qd3d|qd3)" .Or. ;
Lower( cFile ) LIKE ".+\.(svr|wrl|wrz|vrt)" .Or. Empty(cFExt)
oAttach:SetEncoder( "base64" )
Else
oAttach:SetEncoder( "7-bit" )
EndIf
cMimeText := HB_SetMimeType( cFile, cFname, cFext )
// Some EMAIL readers use Content-Type to check for Filename
If ".html" in lower( cFext) .Or. ".htm" in lower( cFext)
cMimeText += "; charSet=ISO-8859-1"
EndIf
oAttach:hHeaders[ "Content-Type" ] := cMimeText
// But usually, original Filename is Set here
oAttach:hHeaders[ "Content-Disposition" ] := "attachment; Filename=" + cFname + cFext
oAttach:SetBody( cData )
oMail:Attach( oAttach )
NEXT
If lRead
oMail:hHeaders[ "Disposition-NotIfication-To" ] := cUser
EndIf
If nPriority != 3
oMail:hHeaders[ "X-Priority" ] := Str( nPriority, 1 )
EndIf
oInmail:Write( oMail:ToString() )
oInMail:Commit()
oInMail:Close()
RETURN lRETURN
//-------------------------------------------------------------//
FUNCTION HB_SetMimeType( cFile, cFname, cFext )
cFile := Lower( cFile )
If cFile LIKE ".+\.vbd" ; RETURN "application/activexDocument="+cFname + cFext
ElseIf cFile LIKE ".+\.(asn|asz|asd)" ; RETURN "application/astound="+cFname + cFext
ElseIf cFile LIKE ".+\.pqi" ; RETURN "application/cprplayer=" + cFname + cFext
ElseIf cFile LIKE ".+\.tsp" ; RETURN "application/dsptype="+cFname + cFext
ElseIf cFile LIKE ".+\.exe" ; RETURN "application/exe="+cFname + cFext
ElseIf cFile LIKE ".+\.(sml|ofml)" ; RETURN "application/fml="+cFname + cFext
ElseIf cFile LIKE ".+\.pfr" ; RETURN "application/font-tdpfr=" +cFname + cFext
ElseIf cFile LIKE ".+\.frl" ; RETURN "application/freeloader=" +cFname + cFext
ElseIf cFile LIKE ".+\.spl" ; RETURN "application/futuresplash =" + cFname + cFext
ElseIf cFile LIKE ".+\.gz" ; RETURN "application/gzip =" + cFname + cFext
ElseIf cFile LIKE ".+\.stk" ; RETURN "application/hstu =" + cFname + cFext
ElseIf cFile LIKE ".+\.ips" ; RETURN "application/ips="+cFname + cFext
ElseIf cFile LIKE ".+\.ptlk" ; RETURN "application/listenup =" + cFname + cFext
ElseIf cFile LIKE ".+\.hqx" ; RETURN "application/mac-binhex40 =" + cFname + cFext
ElseIf cFile LIKE ".+\.mbd" ; RETURN "application/mbedlet="+cFname + cFext
ElseIf cFile LIKE ".+\.mfp" ; RETURN "application/mirage=" +cFname + cFext
ElseIf cFile LIKE ".+\.(pot|pps|ppt|ppz)" ; RETURN "application/mspowerpoint =" + cFname + cFext
ElseIf cFile LIKE ".+\.Doc" ; RETURN "application/msword=" +cFname + cFext
ElseIf cFile LIKE ".+\.n2p" ; RETURN "application/n2p="+cFname + cFext
ElseIf cFile LIKE ".+\.(bin|class|lha|lzh|lzx|dbf)" ; RETURN "application/octet-Stream =" + cFname + cFext
ElseIf cFile LIKE ".+\.oda" ; RETURN "application/oda="+cFname + cFext
ElseIf cFile LIKE ".+\.axs" ; RETURN "application/olescript=" + cFname + cFext
ElseIf cFile LIKE ".+\.zpa" ; RETURN "application/pcphoto="+cFname + cFext
ElseIf cFile LIKE ".+\.pdf" ; RETURN "application/pdf="+cFname + cFext
ElseIf cFile LIKE ".+\.(ai|eps|ps)" ; RETURN "application/postscript=" +cFname + cFext
ElseIf cFile LIKE ".+\.shw" ; RETURN "application/presentations=" + cFname + cFext
ElseIf cFile LIKE ".+\.qrt" ; RETURN "application/quest=" + cFname + cFext
ElseIf cFile LIKE ".+\.rtc" ; RETURN "application/rtc="+cFname + cFext
ElseIf cFile LIKE ".+\.rtf" ; RETURN "application/rtf="+cFname + cFext
ElseIf cFile LIKE ".+\.smp" ; RETURN "application/studiom="+cFname + cFext
ElseIf cFile LIKE ".+\.dst" ; RETURN "application/tajima=" +cFname + cFext
ElseIf cFile LIKE ".+\.talk" ; RETURN "application/talker=" +cFname + cFext
ElseIf cFile LIKE ".+\.tbk" ; RETURN "application/toolbook =" + cFname + cFext
ElseIf cFile LIKE ".+\.vmd" ; RETURN "application/vocaltec-media-desc="+cFname + cFext
ElseIf cFile LIKE ".+\.vmf" ; RETURN "application/vocaltec-media-File="+cFname + cFext
ElseIf cFile LIKE ".+\.wri" ; RETURN "application/write=" + cFname + cFext
ElseIf cFile LIKE ".+\.wid" ; RETURN "application/x-DemoShield =" + cFname + cFext
ElseIf cFile LIKE ".+\.rrf" ; RETURN "application/x-InstallFromTheWeb="+cFname + cFext
ElseIf cFile LIKE ".+\.wis" ; RETURN "application/x-InstallShield="+cFname + cFext
ElseIf cFile LIKE ".+\.ins" ; RETURN "application/x-NET-Install=" + cFname + cFext
ElseIf cFile LIKE ".+\.tmv" ; RETURN "application/x-Parable-Thing="+cFname + cFext
ElseIf cFile LIKE ".+\.arj" ; RETURN "application/x-arj=" + cFname + cFext
ElseIf cFile LIKE ".+\.asp" ; RETURN "application/x-asap=" +cFname + cFext
ElseIf cFile LIKE ".+\.aab" ; RETURN "application/x-authorware-bin =" + cFname + cFext
ElseIf cFile LIKE ".+\.(aam|aas)" ; RETURN "application/x-authorware-map =" + cFname + cFext
ElseIf cFile LIKE ".+\.bcpio" ; RETURN "application/x-bcpio="+cFname + cFext
ElseIf cFile LIKE ".+\.vcd" ; RETURN "application/x-cdLink =" + cFname + cFext
ElseIf cFile LIKE ".+\.chat" ; RETURN "application/x-chat=" +cFname + cFext
ElseIf cFile LIKE ".+\.cnc" ; RETURN "application/x-cnc=" + cFname + cFext
ElseIf cFile LIKE ".+\.(coda|page)" ; RETURN "application/x-coda=" +cFname + cFext
ElseIf cFile LIKE ".+\.z" ; RETURN "application/x-compress=" +cFname + cFext
ElseIf cFile LIKE ".+\.con" ; RETURN "application/x-connector="+cFname + cFext
ElseIf cFile LIKE ".+\.cpio" ; RETURN "application/x-cpio=" +cFname + cFext
ElseIf cFile LIKE ".+\.pqf" ; RETURN "application/x-cprplayer="+cFname + cFext
ElseIf cFile LIKE ".+\.csh" ; RETURN "application/x-csh=" + cFname + cFext
ElseIf cFile LIKE ".+\.(cu|csm)" ; RETURN "application/x-cu-seeme=" +cFname + cFext
ElseIf cFile LIKE ".+\.(dcr|dir|dxr|swa)" ; RETURN "application/x-director=" +cFname + cFext
ElseIf cFile LIKE ".+\.dvi" ; RETURN "application/x-dvi=" + cFname + cFext
ElseIf cFile LIKE ".+\.evy" ; RETURN "application/x-envoy="+cFname + cFext
ElseIf cFile LIKE ".+\.ebk" ; RETURN "application/x-expandedbook=" +cFname + cFext
ElseIf cFile LIKE ".+\.gtar" ; RETURN "application/x-gtar=" +cFname + cFext
ElseIf cFile LIKE ".+\.hdf" ; RETURN "application/x-hdf=" + cFname + cFext
ElseIf cFile LIKE ".+\.map" ; RETURN "application/x-httpd-imap =" + cFname + cFext
ElseIf cFile LIKE ".+\.phtml" ; RETURN "application/x-httpd-php="+cFname + cFext
ElseIf cFile LIKE ".+\.php3" ; RETURN "application/x-httpd-php3 =" + cFname + cFext
ElseIf cFile LIKE ".+\.ica" ; RETURN "application/x-ica=" + cFname + cFext
ElseIf cFile LIKE ".+\.ipx" ; RETURN "application/x-ipix=" +cFname + cFext
ElseIf cFile LIKE ".+\.ips" ; RETURN "application/x-ipscript=" +cFname + cFext
ElseIf cFile LIKE ".+\.js" ; RETURN "application/x-javascript =" + cFname + cFext
ElseIf cFile LIKE ".+\.latex" ; RETURN "application/x-latex="+cFname + cFext
ElseIf cFile LIKE ".+\.bin" ; RETURN "application/x-macbinary="+cFname + cFext
ElseIf cFile LIKE ".+\.mIf" ; RETURN "application/x-mIf=" + cFname + cFext
ElseIf cFile LIKE ".+\.(mpl|mpire)" ; RETURN "application/x-mpire="+cFname + cFext
ElseIf cFile LIKE ".+\.adr" ; RETURN "application/x-msaddr =" + cFname + cFext
ElseIf cFile LIKE ".+\.wlt" ; RETURN "application/x-mswallet=" +cFname + cFext
ElseIf cFile LIKE ".+\.(nc|cdf)" ; RETURN "application/x-netcdf =" + cFname + cFext
ElseIf cFile LIKE ".+\.npx" ; RETURN "application/x-netfpx =" + cFname + cFext
ElseIf cFile LIKE ".+\.nsc" ; RETURN "application/x-nschat =" + cFname + cFext
ElseIf cFile LIKE ".+\.pgp" ; RETURN "application/x-pgp-plugin =" + cFname + cFext
ElseIf cFile LIKE ".+\.css" ; RETURN "application/x-pointplus="+cFname + cFext
ElseIf cFile LIKE ".+\.sh" ; RETURN "application/x-sh =" + cFname + cFext
ElseIf cFile LIKE ".+\.shar" ; RETURN "application/x-shar=" +cFname + cFext
ElseIf cFile LIKE ".+\.swf" ; RETURN "application/x-shockwave-flash=" + cFname + cFext
ElseIf cFile LIKE ".+\.spr" ; RETURN "application/x-sprite =" + cFname + cFext
ElseIf cFile LIKE ".+\.sprite" ; RETURN "application/x-sprite =" + cFname + cFext
ElseIf cFile LIKE ".+\.sit" ; RETURN "application/x-stuffit=" + cFname + cFext
ElseIf cFile LIKE ".+\.sca" ; RETURN "application/x-supercard="+cFname + cFext
ElseIf cFile LIKE ".+\.sv4cpio" ; RETURN "application/x-sv4cpio=" + cFname + cFext
ElseIf cFile LIKE ".+\.sv4crc" ; RETURN "application/x-sv4crc =" + cFname + cFext
ElseIf cFile LIKE ".+\.tar" ; RETURN "application/x-tar=" + cFname + cFext
ElseIf cFile LIKE ".+\.tcl" ; RETURN "application/x-tcl=" + cFname + cFext
ElseIf cFile LIKE ".+\.tex" ; RETURN "application/x-tex=" + cFname + cFext
ElseIf cFile LIKE ".+\.(texinfo|texi)" ; RETURN "application/x-texinfo=" + cFname + cFext
ElseIf cFile LIKE ".+\.tlk" ; RETURN "application/x-tlk=" + cFname + cFext
ElseIf cFile LIKE ".+\.(t|tr|roff)" ; RETURN "application/x-troff="+cFname + cFext
ElseIf cFile LIKE ".+\.man" ; RETURN "application/x-troff-man="+cFname + cFext
ElseIf cFile LIKE ".+\.me" ; RETURN "application/x-troff-me=" +cFname + cFext
ElseIf cFile LIKE ".+\.ms" ; RETURN "application/x-troff-ms=" +cFname + cFext
ElseIf cFile LIKE ".+\.alt" ; RETURN "application/x-up-alert=" +cFname + cFext
ElseIf cFile LIKE ".+\.che" ; RETURN "application/x-up-cacheop =" + cFname + cFext
ElseIf cFile LIKE ".+\.ustar" ; RETURN "application/x-ustar="+cFname + cFext
ElseIf cFile LIKE ".+\.src" ; RETURN "application/x-wais-source=" + cFname + cFext
ElseIf cFile LIKE ".+\.xls" ; RETURN "application/xls="+cFname + cFext
ElseIf cFile LIKE ".+\.xlt" ; RETURN "application/xlt="+cFname + cFext
ElseIf cFile LIKE ".+\.zip" ; RETURN "application/zip="+cFname + cFext
ElseIf cFile LIKE ".+\.(au|snd)" ; RETURN "audio/basic="+cFname + cFext
ElseIf cFile LIKE ".+\.es" ; RETURN "audio/echospeech =" + cFname + cFext
ElseIf cFile LIKE ".+\.(gsm|gsd)" ; RETURN "audio/gsm=" + cFname + cFext
ElseIf cFile LIKE ".+\.rmf" ; RETURN "audio/rmf=" + cFname + cFext
ElseIf cFile LIKE ".+\.tsi" ; RETURN "audio/tsplayer=" +cFname + cFext
ElseIf cFile LIKE ".+\.vox" ; RETURN "audio/voxware=" + cFname + cFext
ElseIf cFile LIKE ".+\.wtx" ; RETURN "audio/wtx=" + cFname + cFext
ElseIf cFile LIKE ".+\.(aIf|aIff|aIfc)" ; RETURN "audio/x-aIff =" + cFname + cFext
ElseIf cFile LIKE ".+\.(cht|dus)" ; RETURN "audio/x-dspeech="+cFname + cFext
ElseIf cFile LIKE ".+\.(mid|midi)" ; RETURN "audio/x-midi =" + cFname + cFext
ElseIf cFile LIKE ".+\.mp3" ; RETURN "audio/x-mpeg =" + cFname + cFext
ElseIf cFile LIKE ".+\.mp2" ; RETURN "audio/x-mpeg =" + cFname + cFext
ElseIf cFile LIKE ".+\.m3u" ; RETURN "audio/x-mpegurl="+cFname + cFext
ElseIf cFile LIKE ".+\.(ram|ra)" ; RETURN "audio/x-pn-realaudio =" + cFname + cFext
ElseIf cFile LIKE ".+\.rpm" ; RETURN "audio/x-pn-realaudio-plugin="+cFname + cFext
ElseIf cFile LIKE ".+\.Stream" ; RETURN "audio/x-qt-Stream=" + cFname + cFext
ElseIf cFile LIKE ".+\.rmf" ; RETURN "audio/x-rmf="+cFname + cFext
ElseIf cFile LIKE ".+\.(vqf|vql)" ; RETURN "audio/x-twinvq=" +cFname + cFext
ElseIf cFile LIKE ".+\.vqe" ; RETURN "audio/x-twinvq-plugin=" + cFname + cFext
ElseIf cFile LIKE ".+\.wav" ; RETURN "audio/x-wav="+cFname + cFext
ElseIf cFile LIKE ".+\.wtx" ; RETURN "audio/x-wtx="+cFname + cFext
ElseIf cFile LIKE ".+\.mol" ; RETURN "chemical/x-mdl-molFile=" +cFname + cFext
ElseIf cFile LIKE ".+\.pdb" ; RETURN "chemical/x-pdb=" +cFname + cFext
ElseIf cFile LIKE ".+\.dwf" ; RETURN "drawing/x-dwf=" + cFname + cFext
ElseIf cFile LIKE ".+\.ivr" ; RETURN "i-world/i-vrml=" +cFname + cFext
ElseIf cFile LIKE ".+\.cod" ; RETURN "image/cis-cod=" + cFname + cFext
ElseIf cFile LIKE ".+\.cpi" ; RETURN "image/cpi=" + cFname + cFext
ElseIf cFile LIKE ".+\.FIf" ; RETURN "image/FIf=" + cFname + cFext
ElseIf cFile LIKE ".+\.gIf" ; RETURN "image/gIf=" + cFname + cFext
ElseIf cFile LIKE ".+\.ief" ; RETURN "image/ief=" + cFname + cFext
ElseIf cFile LIKE ".+\.(jpeg|jpg|jpe)" ; RETURN "image/jpeg=" +cFname + cFext
ElseIf cFile LIKE ".+\.rip" ; RETURN "image/rip=" + cFname + cFext
ElseIf cFile LIKE ".+\.svh" ; RETURN "image/svh=" + cFname + cFext
ElseIf cFile LIKE ".+\.(tIff|tIf)" ; RETURN "image/tIff=" +cFname + cFext
ElseIf cFile LIKE ".+\.mcf" ; RETURN "image/vasa=" +cFname + cFext
ElseIf cFile LIKE ".+\.(svf|dwg|dxf)" ; RETURN "image/vnd=" + cFname + cFext
ElseIf cFile LIKE ".+\.wi" ; RETURN "image/wavelet=" + cFname + cFext
ElseIf cFile LIKE ".+\.ras" ; RETURN "image/x-cmu-raster=" +cFname + cFext
ElseIf cFile LIKE ".+\.etf" ; RETURN "image/x-etf="+cFname + cFext
ElseIf cFile LIKE ".+\.fpx" ; RETURN "image/x-fpx="+cFname + cFext
ElseIf cFile LIKE ".+\.(fh5|fh4|fhc)" ; RETURN "image/x-freehand =" + cFname + cFext
ElseIf cFile LIKE ".+\.dsf" ; RETURN "image/x-mgx-dsf="+cFname + cFext
ElseIf cFile LIKE ".+\.pnm" ; RETURN "image/x-portable-anymap="+cFname + cFext
ElseIf cFile LIKE ".+\.pbm" ; RETURN "image/x-portable-bitmap="+cFname + cFext
ElseIf cFile LIKE ".+\.pgm" ; RETURN "image/x-portable-graymap =" + cFname + cFext
ElseIf cFile LIKE ".+\.ppm" ; RETURN "image/x-portable-pixmap="+cFname + cFext
ElseIf cFile LIKE ".+\.rgb" ; RETURN "image/x-rgb="+cFname + cFext
ElseIf cFile LIKE ".+\.xbm" ; RETURN "image/x-xbitmap="+cFname + cFext
ElseIf cFile LIKE ".+\.xpm" ; RETURN "image/x-xpixmap="+cFname + cFext
ElseIf cFile LIKE ".+\.xwd" ; RETURN "image/x-xwindowdump="+cFname + cFext
ElseIf cFile LIKE ".+\.dig" ; RETURN "multipart/mixed="+cFname + cFext
ElseIf cFile LIKE ".+\.push" ; RETURN "multipart/x-mixed-replace=" + cFname + cFext
ElseIf cFile LIKE ".+\.(wan|waf)" ; RETURN "plugin/wanimate="+cFname + cFext
ElseIf cFile LIKE ".+\.ccs" ; RETURN "text/ccs =" + cFname + cFext
ElseIf cFile LIKE ".+\.(htm|html)" ; RETURN "text/html=" + cFname + cFext
ElseIf cFile LIKE ".+\.pgr" ; RETURN "text/parsnegar-Document="+cFname + cFext
ElseIf cFile LIKE ".+\.txt" ; RETURN "text/plain=" +cFname + cFext
ElseIf cFile LIKE ".+\.rtx" ; RETURN "text/richtext=" + cFname + cFext
ElseIf cFile LIKE ".+\.tsv" ; RETURN "text/tab-separated-values=" + cFname + cFext
ElseIf cFile LIKE ".+\.hdml" ; RETURN "text/x-hdml="+cFname + cFext
ElseIf cFile LIKE ".+\.etx" ; RETURN "text/x-Setext=" + cFname + cFext
ElseIf cFile LIKE ".+\.(talk|spc)" ; RETURN "text/x-speech=" + cFname + cFext
ElseIf cFile LIKE ".+\.afl" ; RETURN "video/animaflex="+cFname + cFext
ElseIf cFile LIKE ".+\.(mpeg|mpg|mpe)" ; RETURN "video/mpeg=" +cFname + cFext
ElseIf cFile LIKE ".+\.(qt|mov)" ; RETURN "video/quicktime="+cFname + cFext
ElseIf cFile LIKE ".+\.(viv|vivo)" ; RETURN "video/vnd.vivo=" +cFname + cFext
ElseIf cFile LIKE ".+\.(asf|asx)" ; RETURN "video/x-ms-asf=" +cFname + cFext
ElseIf cFile LIKE ".+\.avi" ; RETURN "video/x-msvideo="+cFname + cFext
ElseIf cFile LIKE ".+\.movie" ; RETURN "video/x-sgi-movie=" + cFname + cFext
ElseIf cFile LIKE ".+\.(vgm|vgx|xdr)" ; RETURN "video/x-videogram=" + cFname + cFext
ElseIf cFile LIKE ".+\.vgp" ; RETURN "video/x-videogram-plugin =" + cFname + cFext
ElseIf cFile LIKE ".+\.vts" ; RETURN "workbook/formulaone="+cFname + cFext
ElseIf cFile LIKE ".+\.vtts" ; RETURN "workbook/formulaone="+cFname + cFext
ElseIf cFile LIKE ".+\.(3dmf|3dm|qd3d|qd3)" ; RETURN "x-world/x-3dmf=" +cFname + cFext
ElseIf cFile LIKE ".+\.svr" ; RETURN "x-world/x-svr=" + cFname + cFext
ElseIf cFile LIKE ".+\.(wrl|wrz)" ; RETURN "x-world/x-vrml=" +cFname + cFext
ElseIf cFile LIKE ".+\.vrt" ; RETURN "x-world/x-vrt=" + cFname + cFext
EndIf
RETURN "text/plain;Filename=" + cFname + cFext
Re: Email pelo Harbour
Enviado: 08 Mai 2009 17:01
por jamazevedo
Caro Colega.
Alguns servidores de e-mail. como o gmail, não aceitam envio de mensagens que não tenham conecção segura (SSL). No Harbour/xHarbour me parece que este tipo de conexão ainda não foi implementada.
Por exemplo tenho uma conta no UOL e consigo enviar e-mails sem problemas. Já quando configuro para o GMAIL dá erro.
Pelo que analisei nos código acima todos estão corretos, acredito que o problema seja a conexão SSL.
Re: Email pelo Harbour
Enviado: 08 Mai 2009 23:35
por sygecom
Acredito que com o Harbour usando a HBBLAT.LIB, você consiga. Estou usando ela com Harbour e alem de mais rapido o envio, ele tem muito mais recurso que o hb_sendmail() da TIP.LIB
Re: Email pelo Harbour
Enviado: 11 Mai 2009 10:10
por vagucs
nenhuma das rotinas que vi para harbour e xharbour conseguem enviar um email com o corpo da mensagem em formato HTML, se alguem tiver algo pronto neste estilo eu queria uma luz. tenho rotinas em php que uso pelo xhabrour para mandar email aqui.
Re: Email pelo Harbour
Enviado: 12 Mai 2009 13:32
por Itamar M. Lins Jr.
Pelo blat vc pode mandar até arquivos binários.
Saudações,
Itamar M. Lins Jr.
Re: Email pelo Harbour
Enviado: 12 Mai 2009 13:48
por asimoes
Olá Leonardo,
A HBBLAT.LIB tem para xHarbour?
[]´s
Re: Email pelo Harbour
Enviado: 12 Mai 2009 13:50
por vagucs
Entao Itamar, acho estranho usar uma programa externo, nao quero nem posso adotar, as rotinas do xharbour vc pode mandar tambem arquivos binarios, mas preciso do email formtado em HTML, ja analisei as rotinas, se passar um arquivo html como corpo da mensagem era para ele enviar em formato HTML, mas chega sempre em formato texto no destino.
Re: Email pelo Harbour
Enviado: 12 Mai 2009 14:30
por Maligno
Todo eMail é sempre texto, seja em que situação for. A diferença entre texto e
RichText (HTML) está em apenas duas partes: o flag "Content-Type" no cabeçalho da mensagem, onde deve constar a identificação do bloco de texto que representa o HTML (
boundary), e o próprio bloco HTML no corpo da mensagem, onde deve constar um outro "Content-Type" indicando o tipo HTML, o "charset", meio de transporte, etc. Esse bloco, claro, é delimitado pelas tags (
borders) de abertura e fechamento.
Há um RFC que explica isso em detalhes. Só não lembro o número.
Gere um eMail que deveria ser HTML para um arquivo texto e veja no seu editor se ele possui as características que descrevi. Se não for produzida uma mensagem assim, é certo que falta alguma coisa na função de montagem da mensagem. Ou, talvez (não conheço o sistema), alguma configuração extra pra conseguir produzir esse eMail em HTML.
Re: Email pelo Harbour
Enviado: 12 Mai 2009 14:42
por vagucs
É isso mesmo maligno, porem nao gera o email em formato html no lado cliente, mesmo a flag do conteudo estando em text/html.
Nao vi uma rotina em harbour que funcione ainda.
Re: Email pelo Harbour
Enviado: 12 Mai 2009 14:42
por sygecom
asimoes escreveu:Olá Leonardo,
A HBBLAT.LIB tem para xHarbour?
[]´s
Somente para Harbour.