Fórum Email no Indy #358043
06/05/2008
0
Bom dia a todos, depois que atualizei o componente indy para a versão 10.0.20 não consigo mais enviar emails... Procurei pela internet e também aqui no forum e pelo que eu vi o código está certo mas mesmo assim o email com anexo não chega. Vou postar o código e se alguem puder me ajuda eu agradeço. Abraços.
if IBQuery3.FieldByName(´FL_ANEXAR_CORPO_EMAIL´).AsString = ´S´ then begin arquivo := trim(StringReplace(IBQuery3.FieldByName(´DS_ENDERECO_CHART´).AsString,´"´,´´,[rfReplaceAll])); if FileExists(arquivo) then begin IdMessage1.Encoding := meMIME; IdMessage1.ContentType := ´multipart/alternative´; TIdAttachmentFile.create(IdMessage1.MessageParts,arquivo); TextoHtml := TIdText.Create(IdMessage1.MessageParts); TextoHtml.ContentType := ´text/html´; TextoHtml.Body.Add(´<div background-color="#EFEFEF" width="600px" background-repeat="no-repeat" height="40px" margin="0px" font-family="Verdana, Arial, Helvetica, sans-serif"´); TextoHtml.Body.Add(´font-size="10px" color="666666" font-style="normal" line-height="12px" border-top=" 1px solid 999999" border-right="1px dashed 999999"´); TextoHtml.Body.Add(´border-bottom="1px solid 999999" border-left="1px dashed 999999" text-align="left" vertical-align="middle" background-position="0px 5px" padding="1px">´); TextoHtml.Body.Add(´<div text-align="left" padding="5px" margin: "0px">Você está recebendo este e-mail por estar´); TextoHtml.Body.Add(´cadastrado nos boletins da Softin Sistemas.<br />´); TextoHtml.Body.Add(´Para cancelar o envio do boletim, <a href="mailto:´+IBQuery1.FieldByName(´DS_EMAIL_REMOVIVEL1´).AsString+´?Subject=REMOVER´); TextoHtml.Body.Add(´&BODY=APENAS CLIQUE EM ENVIAR!&cc=´+IBQuery1.FieldByName(´DS_EMAIL_REMOVIVEL2´).AsString+´">clique aqui</a>.<br />´); TextoHtml.Body.Add(´Copyright © 2003 Softin Sistemas. Todos os direitos reservados.´); TextoHtml.Body.Add(´</div>´); TextoHtml.Body.Add(´</div>´); end; end; if IBQuery3.FieldByName(´FL_ANEXAR_ENDERECO_SITE´).AsString = ´S´ then begin IdMessage1.Encoding := meMIME; IdMessage1.ContentType := ´multipart/alternative´; arquivo := trim(StringReplace(IBQuery3.FieldByName(´DS_ENDERECO_CHART´).AsString,´"´,´´,[rfReplaceAll])); CorpoHtml := TIdText.Create(IdMessage1.MessageParts); CorpoHtml.ContentType := ´multipart/related´; TextoHtml := TIdText.Create(IdMessage1.MessageParts); TextoHtml.ContentType := ´text/html´; TextoHtml.Body.Add(PageProducer1.Content); TextoHtml.Body.Add(´<div background-color="#EFEFEF" width="600px" background-repeat="no-repeat" height="40px" margin="0px" font-family="Verdana, Arial, Helvetica, sans-serif"´); TextoHtml.Body.Add(´font-size="10px" color="666666" font-style="normal" line-height="12px" border-top=" 1px solid 999999" border-right="1px dashed 999999"´); TextoHtml.Body.Add(´border-bottom="1px solid 999999" border-left="1px dashed 999999" text-align="left" vertical-align="middle" background-position="0px 5px" padding="1px">´); TextoHtml.Body.Add(´<div text-align="left" padding="5px" margin: "0px">Você está recebendo este e-mail por estar´); TextoHtml.Body.Add(´cadastrado nos boletins da Softin Sistemas.<br />´); TextoHtml.Body.Add(´Para cancelar o envio do boletim, <a href="mailto:´+IBQuery1.FieldByName(´DS_EMAIL_REMOVIVEL1´).AsString+´?Subject=REMOVER´); TextoHtml.Body.Add(´&BODY=APENAS CLIQUE EM ENVIAR!&cc=´+IBQuery1.FieldByName(´DS_EMAIL_REMOVIVEL2´).AsString+´">clique aqui</a>.<br />´); TextoHtml.Body.Add(´Copyright © 2003 Softin Sistemas. Todos os direitos reservados.´); TextoHtml.Body.Add(´</div>´); TextoHtml.Body.Add(´</div>´); end; if IBQuery3.FieldByName(´FL_ANEXAR_CORPO_EMAIL_HTML´).AsString = ´S´ then begin TextoHtml := TIdText.Create(IdMessage1.MessageParts); TextoHtml.ContentType := ´text/html´; TextoHtml.Body.LoadFromFile(IBQuery3.FieldByName(´DS_ENDERECO_CHART´).AsString); end; try IdSMTP1.Connect; IdSMTP1.Send(IdMessage1); except end
Douglass
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)