PDA

Ver la Versión Completa : fichero adjunto falla mobil no en pc


toni.vi
12-12-2012, 23:21:17
Utilizo indy 9 y delphi7, y ocurre que cuando en el cuerpo del mensaje pongo una imagen en la cabecera, un cuerpo con html y adjunto un fichero, desde un pc con windows recepciono todo correctamente, pero desde un mobil, en mi caso iPhone, pero tambien en otros mobiles, el fichero adjunto no se recepciona.
¿Alguien le ha ocurrido lo mismo?
el codigo fuente es normalito, os pongo un ejemplo por si quereis reproducirlo.

procedure TForm1.Button1Click(Sender: TObject);
var
html: TStrings;
htmpart, txtpart: TIdText;
bmppart: TIdAttachment;
adjunto: TIdAttachment;
email: TIdMessage;
filename: string;
begin
filename := 'C:\Documento\Header.jpg';
html := TStringList.Create();
html.Add('<html>');
html.Add('<head>');
html.Add('</head>');
html.Add('<body><h1>Hello</h1>');
html.Add('<img src="cid:Header.jpg" />');
html.Add('This is a picture of us!</body>');
html.Add('</html>');

email := TIdMessage.Create(nil);
email.From.Text := 'aaaa@xxxx.com';
email.Recipients.EMailAddresses := 'aaaa@xxxx.com';
email.Subject := 'Hello';
email.ContentType := 'multipart/mixed';
email.Body.Assign(html);

txtpart := TIdText.Create(email.MessageParts);
txtpart.ContentType := 'text/plain';
txtpart.Body.Text := '';

htmpart := TIdText.Create(email.MessageParts, html);
htmpart.ContentType := 'text/html';

bmppart := TIdAttachment.Create(email.MessageParts, filename);
bmppart.ContentType := 'image/jpeg';
bmppart.FileIsTempFile := True;
bmppart.ContentDisposition := 'inline';
bmppart.ExtraHeaders.Values['content-id'] := 'Header.jpg';
bmppart.DisplayName := 'Header.jpg';

adjunto := TIdAttachment.Create(email.MessageParts, 'C:\Documento\bbbb.pdf');


try
idSMTP.Connect();
try
idSMTP.Send(email);
ShowMessage('Sent');
except
on E: Exception do
ShowMessage('Failed: ' + E.Message);
end;
finally
idSMTP.Disconnect();
email.Free();
html.Free();
end;

end;