Add Attachment in My Email Service


I have a problem with my code.. I cant do download attachments, when I click in attachment "[url removed, login to view]", the link appears this way "[url removed, login to view]" but the link doesn't existed, and go to automatically to my home page without download the file..


$id = $_POST['id'];

$pdo = new PDO("sqlite:[url removed, login to view]");

$email = $pdo->query("SELECT * FROM `myemails` WHERE `id`='$myid'")->fetch(PDO::FETCH_ASSOC);

$email_body = base64_decode($email['message']);

$letter_html = "";

//$op_getKey = preg_match_all("/Content-Type: multipart\/alternative; boundary=\"(.*?)\"/", $email_body, $getKey);

//$op_getKey = preg_match_all("/alternative; boundary=\"(.*)\"/", $email_body, $getKey);

$op_getKey = preg_match_all("/boundary=\"(.*)\"/", $email_body, $getKey);

//$has_attachment = preg_match_all("/multipart\/mixed/; boundary=\"(.*?)\"/", $email_body, $attachment);

$has_attachment = preg_match_all("/multipart\/mixed/", $email_body, $attachment);

if ($op_getKey) {

if ($has_attachment) {

$mailParts = explode("--" . $getKey[1][1], $email_body);

$attachParts = explode("--" . $getKey[1][0], $email_body);

$get_attach_name=preg_match_all("/filename=\"(.*?)\"/", $attachParts[2], $attach_name);

$get_attach_type=preg_match_all("/Content-Type: (.*?);/", $attachParts[2], $attach_type);

$pure_code = explode("\n\n",$attachParts[2]);

$pure_code = str_replace("\r","",$pure_code[1]);

$pure_code = str_replace("\n","",$pure_code);


$mailParts = explode("--" . $getKey[1][0], $email_body);



And I call the function this way


<a target="_blank" href="[url removed, login to view]< ?=$attach_name[1][0]? >" data-target="< ?$id? >">< ?=$attach_name[1][0]? >< /a>


So that it is possible, whenever you receive an email, that the file go to the "attachment" folder and can download the images or files ..

And I need a correction of this bug, when receive the emails, in the subject show me like this




I need this in 1 day..

This part of the code is all you need because the rest of the code has nothing to do with this because it is done for several pages and each page has its code .. I can not provide cPanel because I do not work with cPanel, and FTP access also can not.

I show u the rest of the code.

Best Regards

Compétences : PHP, SQLite

en voir plus : Hello , you and Facebook not accept my email , I ask : are you accept Yahoo? , add email service website, email service provider send 100000 emails, how to add attachment to email on ipad, how to send an attachment in gmail, how do you attach a file to an email?, how to attach a photo to an email on iphone, how to send email attachments, how to write an email with attachment, how to attach a file to email on iphone, how to add an attachment to an email on iphone, php, mysql, website design, contact forms, email service send 50000 emails, check email service linux, blast email service, create email service website, application based email service

Concernant l'employeur :
( 1 commentaire ) World, Portugal

Nº du projet : #15393784

Décerné à:


Can fix this in next 1-2 hour, I am available for the work now. Please message me so I can get it done Relevant Skills and Experience 7 years of working exp in php Proposed Milestones €8 EUR - For completion of work Plus

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% EUR en 0 jours
(19 Commentaires)

5 freelance font une offre moyenne de €20 pour ce travail


Hello Sir! i have read your description, i can do it in few minutes. i'm professionals PHP developer. if you want quality work than contact me. Thanks. Relevant Skills and Experience PHP(2+ Years) Proposed Milestones Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% EUR en 0 jours
(5 Commentaires)

I am Akash a Toronto, Canada based web and software developer with 2 years of experience, studied from George Brown College. Relevant Skills and Experience Full stack web developer Proposed Milestones €29 EUR - work Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% EUR en 0 jours
(9 Commentaires)

Dear Sir I have gone through your issue of mail attachment script. I would be please resolve the [login to view URL] initiate further conversation for better understanding and clarity

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% EUR en 1 jour
(6 Commentaires)

Hello I have 5+ years of experience in web development using Php, Codeigniter, bootstrap, mySql, Ajax, jQuery, javascript, CSS, HTML, integration of API with Codeigniter. My solutions enable businesses to leverage lea Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% EUR en 1 jour
(3 Commentaires)