473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

get pic from my mail

i wrote a code that connect to my mail box in gmail and draw specific
picture from specific message with the function imap_fetchbody.after i
did this,how can i show this picture(without save it)?
this is my code:
<?php
$ServerName = "{imap.gmail.com:993/imap/ssl/novalidate-cert}";

$UserName = "user";
$PassWord = "pass";

$mbox = imap_open($ServerName, $UserName,$PassWord) or die("Could
not open Mailbox - try again later!");

$hdr = imap_check($mbox);
echo "Num Messages " . $hdr->Nmsgs ."<br>";

$MN = $hdr->Nmsgs;

$overview=imap_fetch_overview($mbox,"1:$MN",0);
$size=sizeof($overview);

$i=$size-1;

$val=$overview[$i];

$msgno=$val->msgno;
$fileContent=imap_fetchbody($mbox,$msgno,2);

imap_close($mbox);
?>
Jun 27 '08 #1
5 1335
hareldo escribió:
i wrote a code that connect to my mail box in gmail and draw specific
picture from specific message with the function imap_fetchbody.after i
did this,how can i show this picture(without save it)?
this is my code:
<?php
[...] $ServerName = "{imap.gmail.com:993/imap/ssl/novalidate-cert}";
$fileContent=imap_fetchbody($mbox,$msgno,2);

imap_close($mbox);
?>
I suppose $fileContent contains the raw encoded attachement, doesn't it?
First, decode it. If you are using "Content-Transfer-Encoding: base64"
you can do it with map_base64(). Generate an adequate Content-Type
header with header(). And finally, output the string to the browser.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #2
I suppose $fileContent contains the raw encoded attachement, doesn't it?
* First, decode it. If you are using "Content-Transfer-Encoding: base64"
you can do it with map_base64(). Generate an adequate Content-Type
header with header(). And finally, output the string to the browser.
i don't really understand how to this,you mean to wrute this:

header ("Content-Type: image/jpeg");
header ("Content-Disposition: attachment; filename=PICT1262.JPG;");
echo imap_base64($fileContent);

??
if you mean to this,its dont work.

thanks in advance.
Jun 27 '08 #3
hareldo escribió:
>I suppose $fileContent contains the raw encoded attachement, doesn't it?
First, decode it. If you are using "Content-Transfer-Encoding: base64"
you can do it with map_base64(). Generate an adequate Content-Type
header with header(). And finally, output the string to the browser.
i don't really understand how to this,you mean to wrute this:

header ("Content-Type: image/jpeg");
header ("Content-Disposition: attachment; filename=PICT1262.JPG;");
echo imap_base64($fileContent);

??
if you mean to this,its dont work.
If it doesn't work then you need to fix it ;-)

var_dump() your variables and remove the 'Content-Type' header to
display errors.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #4
ok,its work but i want to show it in my page and not to download it to
my computer.
Jun 27 '08 #5
Greetings, hareldo.
In reply to Your message dated Friday, June 27, 2008, 17:07:19,
ok,its work but i want to show it in my page and not to download it to
my computer.
Then why you supplying "Content-Disposition: attachment" header???
--
Sincerely Yours, AnrDaemon <an*******@freemail.ru>

Jun 29 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
6
by: cover | last post by:
I'm using PHP 5 at home w/Apache & MySQL on a test system where I write through a form to a database and also send an email to people on a drop down list. Purpose for this is an electronic log at...
2
mikek12004
by: mikek12004 | last post by:
Before posting here I google it and saw ablut 30 pages for a solution so I pretty much excluded the obvious things. The code is <?php //now to send the mails to seller...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.