Jump to content

Attach image to email without saving to disk


heals1ic

Recommended Posts

Does anyone know of a way to attach jpg image created in php without having to save the file to the server before attaching it?

 

I am using this MIME code to attach the image to an email -

for($i=0;$i<$max;$i++)
            {
                $file = fread(fopen($this->attachment[$i], "r"), filesize($this->attachment[$i]));
                $this->header .= "--".$this->boundary."\n";
                $this->header .= "Content-Type: application/x-zip-compressed; name=".$this->attachment[$i]."\n";
                $this->header .= "Content-Transfer-Encoding: base64\n";
                $this->header .= "Content-Disposition: attachment; filename=".$this->attachment[$i]."\n\n";
                $this->header .= chunk_split(base64_encode($file))."\n";
                $file = "";
            }

Can I attach the image stored as a variable for instance?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.