я понимаю что нужно где то задать параметр iconv UTF-8 а от где и как хз, убил несколько дней на изучение пхп но толку 0.
Помогите пожалуйста.
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- $hostname = '{imap.ukr.net:993/imap/ssl/novalidate-cert}INBOX';
- $username = ''; # например somebody@gmail.com
- $password = '';
- $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
- $max_emails = 16;
- if($emails) {
- $count = 1;
- foreach($emails as $email_number)
- {
- /* get information specific to this email */
- /* get mail message */
- /* get mail structure */
- /* if any attachments found... */
- {
- {
- 'is_attachment' => false,
- 'filename' => '',
- 'name' => '',
- 'attachment' => ''
- );
- if($structure->parts[$i]->ifdparameters)
- {
- foreach($structure->parts[$i]->dparameters as $object)
- {
- {
- $attachments[$i]['is_attachment'] = true;
- $attachments[$i]['filename'] = $object->value;
- }
- }
- }
- if($structure->parts[$i]->ifparameters)
- {
- foreach($structure->parts[$i]->parameters as $object)
- {
- {
- $attachments[$i]['is_attachment'] = true;
- $attachments[$i]['name'] = $object->value;
- }
- }
- }
- if($attachments[$i]['is_attachment'])
- {
- /* 4 = QUOTED-PRINTABLE encoding */
- if($structure->parts[$i]->encoding == 3)
- {
- }
- /* 3 = BASE64 encoding */
- elseif($structure->parts[$i]->encoding == 4)
- {
- }
- }
- }
- }
- /* iterate through each attachment and save it */
- foreach($attachments as $attachment)
- {
- if($attachment['is_attachment'] == 1)
- {
- $filename = $attachment['name'];
- /* prefix the email number to the filename in case two emails
- * have the attachment with the same file name.
- */
- }
- }
- if($count++ >= $max_emails) break;
- }
- }
- /* close the connection */
- echo "Done\n";
- ?>