Jump to content

mark107

Members
  • Content Count

    94
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mark107

  • Rank
    Regular Member

Recent Profile Visitors

1,363 profile views
  1. Code for array: $searchemail = '%' . 'gmail.com' . '%'; $searchsubject = '%' . 'gmail.com' . '%'; $searchmessage = '%' . 'gmail.com' . '%'; $mailbox = $link->prepare("SHOW TABLES"); $mailbox->execute(); $email_arr = array(); $folders = array(); $total_results = 0; $i = 0; while ($folder = $mailbox->fetch(PDO::FETCH_NUM)) { $folder = $folder[0]; //if (strpos($folder, 'trash') !== false) { //$folder = str_replace('trash', '', $folder); //} if (strpos($folder, 'users') !== false) { $folder = str_replace('users', '', $folder); } else { $folders[$i] = $folder; } $i++; } foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); $total_results += $search_mailbox->rowCount(); //Close connection $search_mailbox = null; } $i = 0; $page = 1; $limit = 50; $pages = ceil($total_results / $limit); $end = $limit; $start = 0; if ($page >= 2) { $start = $page * $limit - 50; } echo "the start in page 1 is........................." . $start; echo "<br>"; echo "<br>"; foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); if ($search_mailbox->rowCount() > 0) { foreach($search_mailbox->fetchAll() as $k => $row) { $email_number = $row['id']; $search_from = $row['from_email']; $search_subject = $row['subject']; $email_arr[$i] = ['email_number' => $email_number, 'email_from' => $search_from, 'email_subject' => $search_subject]; $i++; } } } $test = array_slice($email_arr, $start, $end); $ii = 0; foreach($test as $emails) { $ii++; echo $emails['email_subject'] . '........................' . $ii; echo "<br>"; echo "<br>"; echo "<br>"; } Code for database: $searchemail = '%' . 'gmail.com' . '%'; $searchsubject = '%' . 'gmail.com' . '%'; $searchmessage = '%' . 'gmail.com' . '%'; $mailbox = $link->prepare("SHOW TABLES"); $mailbox->execute(); $folders = array(); $total = 0; $total_rows = 0; $i = 0; while ($folder = $mailbox->fetch(PDO::FETCH_NUM)) { $folder = $folder[0]; if (strpos($folder, 'users') !== false) { $folder = str_replace('users', '', $folder); } else { $folders[$i] = $folder; } $i++; } foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT 0, 50"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); if ($search_mailbox->rowCount() > 0) { $total += $search_mailbox->rowCount(); } } $i = 0; $page = 1; $limit = 50; $pages = ceil($total_results / $limit); $end = $limit; $start = 0; if ($page >= 2) { $start = $page * $limit - 50; } $offset = ($page - 1) * $limit; echo 'start.........................' . $start; echo "<br>"; echo 'end.........................' . $end; echo "<br>"; foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT 50, 50"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); if ($search_mailbox->rowCount() > 0) { foreach($search_mailbox->fetchAll() as $k => $row) { $email_number = $row['id']; $search_from = $row['from_email']; $search_subject = $row['subject']; $limit--; $total_rows++; echo $search_subject . '.........................' . $total_rows; echo "<br>"; } } }
  2. here is the results for the array when I am on the page 1: Image body........................1 Hey........................2 Hey........................3 Testing........................4 Re: Re: This weekend........................5 Re: This weekend........................6 This weekend........................7 Hey........................8 Meeting this weekend........................9 Meeting this weekend........................10 Re: Working on a project........................11 Hey Mark 7........................12 Hey Mark 6........................13 Hey Mark 5........................14 Hey Mark 4........................15 Hey Mark 3........................16 Hey Mark 2........................17 Hey Mark........................18 This lead Unsubscribed: ************@gmail.com........................19 This lead Unsubscribed: ************@gmail.com........................20 This lead Unsubscribed: ************@gmail.com........................21 This lead Unsubscribed: ************@gmail.com........................22 This lead Unsubscribed: ************@gmail.com........................23 This lead Unsubscribed: ************@gmail.com........................24 This lead Unsubscribed: ************@gmail.com........................25 This lead Unsubscribed: ************@gmail.com........................26 This lead Unsubscribed: ************@gmail.com........................27 This lead Unsubscribed: ************@gmail.com........................28 This lead Unsubscribed: ************@gmail.com........................29 This lead Unsubscribed: ************@gmail.com........................30 Hey........................31 Контрольные точки в переговорах........................32 Hey 2........................33 Hey........................34 Hey........................35 test spam........................36 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads........................37 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads........................38 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads........................39 Test 4 images........................40 Hey Mark........................41 Image body........................42 zip and rar attachment........................43 test image attachment no 5........................44 Hey........................45 Image in body and attachement........................46 checking message body........................47 New Email For Test........................48 Test Message From Shibbir........................49 Hey Mark 2........................50 here is the results for the array when I am on the page 2: Re: Test Email by Koviri J........................1 Re: Test Email by Koviri J........................2 Test Email by Koviri J........................3 How are you........................4 Hey Mark........................5 Re: Meeting this weekend........................6 Hello........................7 Re: What’s the minimum?........................8 1,000 visitors per DAY.........................9 DIRTY CHEAP traffic!........................10 4 cent clicks. (OPEN NOW)........................11 Up to $400... per DAY...........................12 Turn a few bucks into $197+...........................13 How To Get An Extra $100-$500 in Your PayPal........................14 Re: Test Email........................15 GET MONEY in the next 24 hours - up to $200+ per day...........................16 3 steps to $200+ a day...........................17 $318+ per day with this 60 SECOND NICHE SITE GENERATOR...........................18 Booooooombarded............................19 THIS WEEKEND: Over $400 in less than 1 hour............................20 FREEEEEE videooooooooo traaaaaaffic............................21 THIS WEEKEND: $408 in 45 minutes..........................22 Weird system SPITS OUT $97 payments...........................23 $97 a pop pop pop...........................24 FREE SYSTEM: Affiliate marketing IN REVERSE...........................25 traaaaaaaaaaaaaaaaaaaffiiiiiiiiiiic........................26 dead business........................27 hey, YOU need this........................28 CLONE this!........................29 Your money........................30 Re: Hey........................31 Re: Hey........................32 AI: New FREE 7 figure traffic getting system............................33 FREE SYSTEM: Stuffs your pockets with $20 bills...........................34 FREEEEEEEEEE system sucks in $20 bills...........................35 DFY websites that suck in $12,000+ per month (can be YOURS)............................36 OPEN NOW: If you've never made money online (new $12K per month system)............................37 $100 to $200, day after day...........................38 CASH FAST: $200 a day...........................39 You bloody motherfucker didn't pay anyone...........................40 you're only $200-a-day away from FIRING your boss...........................41 -----> weird fun income video for ya...........................42 Re:........................43 Re:........................44 Re:........................45 Re:........................46 Re:........................47 ........................48 my last email...........................49 crazy deal........................50 Here is the results for the database when I am on the page 1: Image body.........................1 Hey.........................2 Hey.........................3 Testing.........................4 Re: Re: This weekend.........................5 Re: This weekend.........................6 This weekend.........................7 Hey.........................8 Meeting this weekend.........................9 Meeting this weekend.........................10 Re: Working on a project.........................11 Hey Mark 7.........................12 Hey Mark 6.........................13 Hey Mark 5.........................14 Hey Mark 4.........................15 Hey Mark 3.........................16 Hey Mark 2.........................17 Hey Mark.........................18 This lead Unsubscribed: ************@gmail.com.........................19 This lead Unsubscribed: ************@gmail.com.........................20 This lead Unsubscribed: ************@gmail.com.........................21 This lead Unsubscribed: ************@gmail.com.........................22 This lead Unsubscribed: ************@gmail.com.........................23 This lead Unsubscribed: ************@gmail.com.........................24 This lead Unsubscribed: ************@gmail.com.........................25 This lead Unsubscribed: ************@gmail.com.........................26 This lead Unsubscribed: ************@gmail.com.........................27 This lead Unsubscribed: ************@gmail.com.........................28 This lead Unsubscribed: ************@gmail.com.........................29 This lead Unsubscribed: ************@gmail.com.........................30 Hey.........................31 Контрольные точки в переговорах.........................32 Hey 2.........................33 Hey.........................34 Hey.........................35 test spam.........................36 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................37 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................38 [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................39 Test 4 images.........................40 Hey Mark.........................41 Image body.........................42 zip and rar attachment.........................43 test image attachment no 5.........................44 Hey.........................45 Image in body and attachement.........................46 checking message body.........................47 New Email For Test.........................48 Test Message From Shibbir.........................49 Hey Mark 2.........................50 Re: Test Email by Koviri J.........................51 Re: Test Email by Koviri J.........................52 Test Email by Koviri J.........................53 The computer must make money.........................54 Earnings on your PC.........................55 Программа пассивного дохода.........................56 How to use a PC to earn money?.........................57 test.........................58 How to use a PC to earn money?.........................59 Security Notice. mark@************.com was hacked! Change your password now!.........................60 Test signature.........................61 Try this.........................62 Hey.........................63 Hey.........................64 Hey.........................65 ***SPAM*** [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................66 ***SPAM*** [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................67 ***SPAM*** [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................68 ***SPAM*** [Earn 50 Credits] - Get A 10-Pack Of Ads At Ads.........................69 [Earn 50 Credits] - Get A 10-Pack Of Ads At EvolutionAds.........................70 ***SPAM*** stuff $400 a day with this............................71 ***SPAM*** .........FAST cash...................................72 ***SPAM*** URGENT: Here's how my buddy Matt made over $50,000 last month............................73 ***SPAM*** .........$500+ per day campaigns DONE FOR YOU....................................74 Testing 2.........................75 This weekend.........................76 This lead Unsubscribed: ************@gmail.com.........................77 This lead Unsubscribed: ************@gmail.com.........................78 test spam.........................79 Here is the results for the database when I am on the page 2: How are you.........................1 Hey Mark.........................2 Re: Meeting this weekend.........................3 Hello.........................4 Re: What’s the minimum?.........................5 1,000 visitors per DAY..........................6 DIRTY CHEAP traffic!.........................7 4 cent clicks. (OPEN NOW).........................8 Up to $400... per DAY............................9 Turn a few bucks into $197+............................10 How To Get An Extra $100-$500 in Your PayPal.........................11 Re: Test Email.........................12 GET MONEY in the next 24 hours - up to $200+ per day............................13 3 steps to $200+ a day............................14 $318+ per day with this 60 SECOND NICHE SITE GENERATOR............................15 Booooooombarded.............................16 THIS WEEKEND: Over $400 in less than 1 hour.............................17 FREEEEEE videooooooooo traaaaaaffic.............................18 THIS WEEKEND: $408 in 45 minutes...........................19 Weird system SPITS OUT $97 payments............................20 $97 a pop pop pop............................21 FREE SYSTEM: Affiliate marketing IN REVERSE............................22 traaaaaaaaaaaaaaaaaaaffiiiiiiiiiiic.........................23 dead business.........................24 hey, YOU need this.........................25 CLONE this!.........................26 Your money.........................27 Re: Hey.........................28 Re: Hey.........................29 AI: New FREE 7 figure traffic getting system.............................30 FREE SYSTEM: Stuffs your pockets with $20 bills............................31 FREEEEEEEEEE system sucks in $20 bills............................32 DFY websites that suck in $12,000+ per month (can be YOURS).............................33 OPEN NOW: If you've never made money online (new $12K per month system).............................34 $100 to $200, day after day............................35 CASH FAST: $200 a day............................36 You bloody bad didn't pay anyone............................37 you're only $200-a-day away from FIRING your boss............................38 -----> weird fun income video for ya............................39 Re:.........................40 Re:.........................41 Re:.........................42 Re:.........................43 Re:.........................44 .........................45 my last email............................46 crazy deal.........................47 OUTTA NOWHERE: Newbie system rakes over $8,000 per mo. ...............................48 $8k per month for NEWBIES............................49 FAST $20-$80 within 24 hours (open up to start)............................50
  3. I find it very strange because when I store the list of strings in the array and when I use: $test = array_slice($email_arr, 50, 50); It works fine, but when I try this: $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT 50, 50"); I will not be able to see the same output as above. Any idea?
  4. Thanks, but it will do nothing as it will display more than 50 rows.
  5. What value do you want me to reset before each folder?
  6. Yes, I am getting more than 50 per folder. So I want to display 50 total per page.
  7. Im sorry but it is still not resolve as I have been checking on my keywords. I'm still getting more than 50 rows in per page so I dont know what to do and how to resolve it. Do I have to use something is like the arrays or something like that if it would help or not? If it would not help then what I need to do?
  8. Already done it. It is a shame that no one could help me to solve it when I have to find my own way to solve it.
  9. I have tried it but it doesn't work. Because of this I am using each folder under the loop so there is no way to avoid it unless I have to use one table or store the list of strings in the array or something like that.
  10. There is no syntax error. So what you mean for the folder thing that's not really good? I can see the full output for the email subjects. I cant be able to limit it to 50 when I'm searching for each folder. If I search one folder it will works fine, so I want to search for all folders. Any idea how I can be able to limit it to allow me to display them in page 1, page 2 and so on?
  11. Hi all, I need your help as I have got a problem with display the 50 rows in the search results. I want to limit 50 rows in per page and if I have less than 50 rows like 21 rows in the page 2 then display the 21 rows. I have got a problem with the limit, because when I tried to use `LIMIT 0, 50`, it will display total 71 rows which I only want to display no more than 50 in per page. Here is what I have tried: $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT 0, 50"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); And I have also tried this: $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT $offset, $limit"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); It will not limit the rows I want. It will still show the 71 rows. Here is the full code: <?php // Initialize the session session_start(); //Connect to the database require_once('config.php'); $searchemail = '%' . 'gmail.com' . '%'; $searchsubject = '%' . 'gmail.com' . '%'; $searchmessage = '%' . 'gmail.com' . '%'; $mailbox = $link->prepare("SHOW TABLES"); $mailbox->execute(); $folders = array(); $total = 0; $total_rows = 0; $i = 0; while ($folder = $mailbox->fetch(PDO::FETCH_NUM)) { $folder = $folder[0]; if (strpos($folder, 'users') !== false) { $folder = str_replace('users', '', $folder); } else { $folders[$i] = $folder; } $i++; } foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT 0, 50"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); if ($search_mailbox->rowCount() > 0) { $total += $search_mailbox->rowCount(); } } $page = 1; $limit = 50; //$per_page = 50; //$pages = ceil($total / $per_page); $offset = ($page - 1) * $limit; foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT $offset, $limit); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); if ($search_mailbox->rowCount() > 0) { foreach($search_mailbox->fetchAll() as $k => $row) { $email_number = $row['id']; $search_from = $row['from_email']; $search_subject = $row['subject']; $total_rows++; echo $search_subject . '.........................' . $total_rows; echo "<br>"; } } } ?> I am unable to fetch the first 50 rows in the page 1 and I am also unable to fetch the 21 rows in the page 2. What I am trying to achieve is when I am in page 1, I want to display the first 50 rows, then in the page 2 if I have another 50 rows then display the 50 rows, but if I have less than 50 rows like 21 rows then display the 21 rows. Can you please show me an example how I can start with first 50 rows when I am in the page 1 then in page 2 display 21 rows to make in total 71 rows? Any advice would be much appreicated. Thanks in advance.
  12. Hi all, I need some help with my code as I've a trouble with sending the emails with images attachments. I'm using Pear Mail library to send the emails so when I send the emails with attachments to gmail, I am unable to see the attached images in my gmail inbox as there is no images show on the bottom of the subject unless when I open on my email so I can see the images attachments. And I am unable to see the images on yahoo when i sent the emails, so I sent a test email on my webmail with the images as attachments and I can see the images on gmail and yahoo with no problem. I think there is a problem with my PHP script that need to be resolve. Here is where I am getting the problem with: //attachments if (is_array($email_attachments)) { foreach ($email_attachments as $attachments) { $filename = str_replace('uploads/', '', $attachments); $attachment = ''; $file_path = ''; $type = ''; if (strpos($filename, '.png') !== false) { $type .= 'image/png'; } // ADD attachment(s) $attachment1 .= "--$boundary1\r\n"; $attachment1 .= "Content-Type: $type; name=\"$filename\"\r\n"; $attachment1 .= "Content-Transfer-Encoding: base64\r\n"; $attachment1 .= "Content-Disposition: attachment; filename=\"$filename\"\r\n"; $attachment1 .= "\r\n\r\n"; $attachment1 .= $attachment; $attachment1 .= "\r\n\r\n"; $body .= $attachment1; $mime->addAttachment($file_path, $type); } } Here is the full code: <?php require_once('Mail.php'); require_once('Mail/mime.php'); require_once('Mail/IMAPv2.php'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); //Connect to the database include('config.php'); // Connect to the server: $username = 'myusername'; $password = 'mypassword'; $smtp_hostname = "smtp.mydomain.com"; $port = "587"; $attached_files = array(); $inline_images = array(); global $inline_images; if (isset($_POST['send_to'])) { $from = "Mark <name@mydomain.com>"; $to_email = $_POST['send_to']; $subject = $_POST['email_subject']; $message ='<div dir="ltr">' . $_POST['email_body'] . '</div>'; $email_attachments = $_POST['email_attachment']; $total_emails = count($to_email); $email_number = $_POST['email_number']; $sent_message = $message; $attachment1 = ''; $inline_id = 0.1; $success = ''; $base64 = []; $src = []; //Check if the images is base64 if (strpos($message, 'data:image/') !== false) { // read all image tags into an array preg_match_all('/<img.*?src="data:image\/.*;.*,(.*)".*?>/i', $message, $match, PREG_PATTERN_ORDER); $base64 = array_pop($match); if (is_array($src)) { foreach($base64 as $images) { $type = end(explode('/', (explode(';', $images))[0])); $filename = md5(time().uniqid()). '.' . $type; $base64_string = str_replace('data:image/png;base64,', '', $images); $base64_string = str_replace(' ', '+', $base64_string); $decoded = base64_decode($base64_string); $fp = fopen("uploads/". $filename, "w+"); fwrite($fp, $decoded); fclose($fp); } } } //check if the inline images is in the array if (strpos($message, '<img src=') !== false) { // read all image tags into an array preg_match_all('@src="([^"]+)"@' , $message, $match); $src = array_pop($match); if (is_array($src)) { foreach ($src as $key => $value) { $parsed = parse_url($src[$key]); $filename = basename($parsed['path']); $content = file_get_contents($src[$key]); if (!file_exists($filename)) { $fp = fopen("uploads/". $filename, "w+"); fwrite($fp, $content); fclose($fp); } } } } $boundary1 = '###'.md5(microtime()).'###'; $boundary2 = '###'.md5(microtime().rand(99,999)).'###'; foreach ($to_email as $to) { $name = ''; $email = ''; if (strpos($to, ' <') !== false) { $name_str = explode(' <', $to); $email_str = explode(' <', $to); $name = $name_str[0]; $email = str_replace('>', '', $email_str); $email = $email[1]; } $messageID = sprintf("<%s.%s@%s>", base_convert(microtime(), 10, 36), base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36), 'mydomain.com'); $message_id = getMessageid(isset($message_id)); $now = new DateTime(); $email_id = $now->getTimestamp(); $sent_date = date('Y-m-d H:i:s'); $sent_mailbox1 = $link->prepare("SELECT * FROM sent WHERE message_id = ?"); $sent_mailbox1->execute([$message_id]); $emailID = ''; if (!$name == '' && !$email == '') { if ($name == $email) { $to = $email; } } if ($sent_mailbox1->rowCount() == 0) { $sent_mailbox1 = $link->prepare("INSERT INTO sent (from_email, to_email, message_id) VALUES (?,?,?)"); if ($sent_mailbox1->execute([$from, $to, $message_id])) { $emailID = $link->lastInsertId(); } } //check if the images is base64 if (is_array($base64)) { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } else if (!$base64 == '') { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } //check if the inline images is in the array if (is_array($src)) { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } else if (!$src == '') { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } $message .= '<img src="http://mydomain.com/track/Images/signature.gif?id='.$emailID.'&etc='.time(). '" ' . 'style="width:0;max-height:0;overflow:hidden" alt="">'; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject, 'Reply-To' => $from, //'Content-Type' => 'Content-Type: text/plain; charset="UTF-8"', 'Content-Type' => 'Content-Type: multipart/mixed; boundary="=_d909e7abc497193ad3b6636530382391"', 'MIME-Version' => '1.0', 'Received' => 'from mail.mydomain.com', 'Date' => date("r"), 'Message-ID' => '<'.sha1(microtime(true)).'@mydomain.com>'); $crlf = "\r\n"; $mime = new Mail_mime(array('eol' => $crlf)); //$mime = new Mail_mime("\r\n"); $html = $message; $text = strip_tags($html); $body = $html; $mime->setTXTBody($text); $mime->setHTMLBody($html); //check if the img tags have url called display=view if (strpos($message, 'display=view') !== false) { $pattern = '@src="([^"]+)"@'; $message = preg_replace_callback($pattern,"setImageLinks", $message); foreach ($inline_images as $inline_image) { $file_path = $inline_image; $typeInt = imagetype($file_path); //code goes here to find the imagetype case switch ($typeInt) { case IMG_GIF: $imageType = 'image/gif'; break; case IMG_JPG: $imageType = 'image/jpg'; break; case IMG_JPEG: $imageType = 'image/jpeg'; break; case IMG_PNG: $imageType = 'image/png'; break; case IMG_WBMP: $imageType = 'image/wbmp'; break; case IMG_XPM: $imageType = 'image/xpm'; break; default: $imageType = 'unknown'; } $mime->addHTMLImage($file_path, $imageType); } } //attachments if (is_array($email_attachments)) { foreach ($email_attachments as $attachments) { $filename = str_replace('uploads/', '', $attachments); $attachment = ''; $file_path = ''; $type = ''; if (strpos($filename, '.png') !== false) { $type .= 'image/png'; } // ADD attachment(s) $attachment1 .= "--$boundary1\r\n"; $attachment1 .= "Content-Type: $type; name=\"$filename\"\r\n"; $attachment1 .= "Content-Transfer-Encoding: base64\r\n"; $attachment1 .= "Content-Disposition: attachment; filename=\"$filename\"\r\n"; $attachment1 .= "\r\n\r\n"; $attachment1 .= $attachment; $attachment1 .= "\r\n\r\n"; $body .= $attachment1; $mime->addAttachment($file_path, $type); } } // always call these methods in this order $mime_params = array( 'text_encoding' => '7bit', 'text_charset' => '"UTF-8"', 'html_charset' => '"UTF-8"', 'head_charset' => '"UTF-8"' ); //$body = $mime->get(array('text_encoding' => '8bit','html_encoding' => '8bit')); $body = $mime->get($mime_params); $headers = $mime->headers($headers); $smtp_params = array ('host' => $smtp_hostname, 'port' => $port, 'auth' => true, // Note 1 'username' => $username, 'password' => $password); $smtp = Mail::factory('smtp', $smtp_params); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Email has been sent!</p>"); $response = array("success"=>$success); echo json_encode($response); } } } Do you know why the images wont show up on yahoo and gmail when I send the images as attachment? I have checked on the image path and i have put the correct image path so it should work fine. If you can be able to test it for me to find out why the images wont display and if you fix the issue, please let me know what change I need to make so I will try it out. Any advice would be much appreciated. Thanks in advance.
  13. Thank you very much for this as it is working great. Problem are now resolved.
×
×
  • 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.