Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke)

Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 25.10.2010. u 18:01 · pre 196 meseci #1
Postoje vise nacina da se doda slika u telo email pruke:
1. kao inline slika,
2. uploadovati sliku na nekom serveru pa njen lilnk postaviti u samoj poruci
Code:
<img src="html://www.example.com/image.jpg" />

3. u nekim email porukama sam video da se slike koje se nalaze u samoj poruci nalaze takodje u atacmentu.

Za ovaj treci slucaj me zanima kako da atacovanu sliku ubacim u telo poruke.
Nisam probao ali mi se cini da ovo nece da radi:
1. Imam atacovanu sliku image.jpg
2. u telu poruke stavljam
Code:
<img src="image.jpg" />


Podrazumeva se da je poruka u html formatu.
Potpis
Dalibor Zdravkovic
Re: Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 25.10.2010. u 18:16 · pre 196 meseci #2
moras da koristis Content-ID (CID) attachmenta kada linkujes sliku:
Code:

<img src="cid:..." />


evo primera u cistom php-u (bez nekih mail biblioteka): http://www.phpeveryday.com/art...Images-in-HTML-Email-P113.html
Potpis
rafforum.rs - Forum Računarskog Fakulteta
Re: Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 20.01.2011. u 22:09 · pre 193 meseca #5
I ja imam isti problem. Koristim phpmailer klasu.

$mail->AddEmbeddedImage("images/logo.jpg", "my-attach", "rocks.png");
$mail->Body = 'Embedded Image: <img alt="PHPMailer" src="cid:my-attach"> Here is an image!';


I sta se desava?
Pa bude u attachment-u a ne u contentu? Iako ne bi trebalo :/
Re: Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 21.01.2011. u 14:42 · pre 193 meseca #7
Evo mog kôda:

Code:


<?php


require_once 'swiftmailer/lib/swift_required.php';

//Create the Transport
$transport = Swift_SmtpTransport::newInstance('mail.domen.ba', 26)
  ->setUsername('[email protected]')
  ->setPassword('password')
  ;

 

//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

//Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('[email protected]' => 'John Doe'))
  ->setTo(array('[email protected]' => 'A name'));
  
  
  $cid = $message->embed(Swift_Image::fromPath('images/logo.jpg'));

$message->setBody(
'<html>' .
' <head></head>' .
' <body>' .
'  Here is an image <img src="' . $cid . '" alt="Image" />' .
'  Rest of message' .
' </body>' .
'</html>',
  'text/html' //Mark the content-type as HTML
);



//Send the message
$result = $mailer->send($message);

 
?>



Rezultat na gmail-u:

http://img89.imageshack.us/img89/9461/rezultaty.png

Uopste ga ne ubaci... isto mi se desava i sa phpmailer-om. Zna li ko u cemu je problem?
Re: Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 21.01.2011. u 18:54 · pre 193 meseca #8
Citat:
Aleksandar Ružičić: moras da koristis Content-ID (CID) attachmenta kada linkujes sliku:
Code:

<img src="cid:..." />


evo primera u cistom php-u (bez nekih mail biblioteka): http://www.phpeveryday.com/art...Images-in-HTML-Email-P113.html


pazljivije citajte malo momci :)

i da, kada testirate u gmail-u da li se vide slike u mejlu ne zaboravite da kliknete na "Show images below" link jer ih gmail po defaultu ne prikazuje.
Potpis
rafforum.rs - Forum Računarskog Fakulteta
Re: Display attached image in email body (Kako prikazati atacovanu sliku u telu email poruke) 22.01.2011. u 10:11 · pre 193 meseca #11
Evo sa Google bloga:

We do this to help protect your privacy from spammers, who can use images and links to verify that your email address is real.

Code:

But often the messages you get with images are from friends or family and there's no reason to worry about your privacy — you just 
want to see the photo of your newborn niece or the invitation design they're sending you. So, in these cases, we've decided to start 
displaying images by default. Now, whenever someone you've emailed at least twice sends you a message containing images, 
you'll see them right away.


Znaci, vidjecu slike po defaultu od onoga koga sam najmanje dva puta kontaktirao :)

Sta je sa hotmaila? I tu mi bude kao attachment :) Nesto slicno?
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme