humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
Changelog
get_message_by_attachment_name_via_imap
get_message_by_attachment_name_via_imap($folder,$name,$exactly=false,$number=0,$timeout=300); - Получить письмо по имени вложенного файла IMAPФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Get message by attachment name using IMAP protocol $xhe_host = getenv("RPABOT_HOST_URL"); if (!isset($path)){ // Path to the init.php file for connecting to the XHE API $path = "../../../Templates/init.php"; // Including init.php grants access to all classes and functionality for working with the XHE API require($path); } // Start echo("\n<span style=\"color: blue; \">mail->" .basename (__FILE__). "</span>\n"); // Set search depth limit for number of messages echo("\nSet search depth limit for number of messages: 100"); var_export(WEB::$mail->set_limit(100)); echo("\n\nTEST YA"); $imapServer = 'imap.yandex.ru'; $imapPort = 993; $imapLogin = new EncodedVariable('YandexImapLogin'); // Create variable 'YandexImapLogin' in "Security Manager" $imapPassword = new EncodedVariable('YandexImapPassword'); // Create variable 'YandexImapPassword' in "Security Manager" $sslOption = 2; // Connection encryption: 2 (ssl) $certType = ''; $timeout = 3000; $logPath = 'imap_log.txt'; $targetFolder = 'test'; $fromSearch = $imapLogin; try { // Step 1 echo("\nStep 1. Connect to IMAP server: "); $isConnected = WEB::$mail->imap_connect($imapServer, $imapPort, $imapLogin, $imapPassword, $sslOption, $certType, $timeout, $logPath); var_export($isConnected); if ($isConnected) { // Example 1 echo("\n\nExample 1. Get message by attachment file name 'test': "); $attachmentName = "test"; $message = WEB::$mail->get_message_by_attachment_name_via_imap($targetFolder, $attachmentName); if (!empty($message->from)) { echo("id: " . $message->message_id . "\n"); echo("from: " . $message->from . "\n"); echo("subject: " . $message->subject . "\n"); echo("date: " . $message->date . "\n"); echo("body length: " . strlen($message->body) . "\n\n"); } else { echo('Message not found!'); } } } finally { echo("\nDisconnect: "); var_export(WEB::$mail->imap_disconnect()); } // Quit the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7022" from xweb_human_emulator import * # начало echo("<hr><font color=blue>mail.xxxxxxxxx</font><hr>") login = "xxx@mail.ru"; psw = "xxx"; # 1 echo("1. Соединимся с IMAP сервером : ") echo(mail.imap_connect("imap.mail.ru",993,login,psw),"\n") # 2 echo("2. Получим письмо : ") message = mail.get_message_by_text_via_imap("", "test") echo(" from: "+message.from_+"\n") echo(" subject: "+message.subject+"\n") echo(" date: "+message.date+"\n") echo(" body : "+message.body+"\n\n") # 3 echo("3. Получим число писем : ") echo(mail.get_message_count_via_imap()+"\n") # 4 echo("4. Отсоединиться : ") echo(mail.imap_disconnect(),"\n") # конец echo("<hr><br>") # Quit app.quit()
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program:XHEScript { static void Main(string[] args) { // init XHE server = Environment.GetEnvironmentVariable("RPABOT_HOST_URL"); InitXHE(); // начало echo("<hr><font color=blue>mail->get_message_by_text_via_imap</font><hr>"); var login = "xxx@mail.ru"; var psw = "xxx"; // 1 echo("1. Соединимся с IMAP сервером : "); echo(mail.imap_connect("imap.mail.ru",993,login,psw)+"\n"); // 2 echo("2. Получим письмо : "); var message = mail.get_message_by_attachment_name_via_imap("", "t"); echo(" from: "+message.from+"\n"); echo(" subject: "+message.subject+"\n"); echo(" date: "+message.date+"\n"); echo(" body : "+message.body+"\n\n"); // 3 echo("3. Получим число писем : "); echo(mail.get_message_count_via_imap()+"\n"); // 4 echo("4. Отсоединиться : "); echo(mail.imap_disconnect()+"\n"); // конец echo("\n\n"); // Quit app.quit(); } }
xhe_host = "127.0.0.1:7022";
echo=require("../../../Templates JS/init.js");
// начало
echo("<hr><font color=blue>mail->get_message_by_text_via_imap</font><hr>");
login = "xxx@mail.ru";
psw = "xxx";
// 1
echo("1. Соединимся с IMAP сервером : ");
echo(mail.imap_connect("imap.mail.ru",993,login,psw)+"\n");
// 2
echo("2. Получим письмо : ");
var message = mail.get_message_by_attachment_name_via_imap("", "test");
echo(" from: "+message.from+"\n");
echo(" subject: "+message.subject+"\n");
echo(" date: "+message.date+"\n");
echo(" body : "+message.body+"\n\n");
// 3
echo("3. Получим число писем : ");
echo(mail.get_message_count_via_imap()+"\n");
// 4
echo("4. Отсоединиться : ");
echo(mail.imap_disconnect()+"\n");
// конец
echo("\n");
// Quit
app.quit();=============================================
Mail Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.