Return email based on $email_id

@param $email_id mail_id of the requested email
@return bool
349531
public function fetchEmail($email_id)
    {
        $action = "fetch_email";
        $options = array(
            'email_id' => $email_id,
            'sid_token' => $this->sid_token
        );

        return $this->client->get($action, $options);
    }
832853
public Mail findMail(int id) {
    if (items == null) {
      return null;
    }

    for (Mail m : items) {
      if (m.getId() == id) {
        return m;
      }
    }

    return null;
  }
486367
public function getList($id = null)
    {
        if ($this->_mails) {
            if ($id != null && isset($this->_mails[$id])) {
                return [filesize($this->_path.'/'.$this->_mails[$id]['file_name'])];
            }

            $result = [];
            foreach ($this->_mails as $mail) {
                $result[] = filesize($this->_path.'/'.$mail['file_name']);
            }

            return $result;
        }

        return null;
    }
132009
public function get($id)
    {
        $response = $this->mailjet->get(Resources::$Template, ['id' => $id]);
        if (!$response->success()) {
            $this->throwError("TemplateService:get() failed", $response);
        }

        return $response->getData();
    }
615712
public function getUID($email)
    {
        $query = "SELECT id FROM {$this->config->table_users} WHERE email = :email";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute(['email' => $email]);

        if ($query_prepared->rowCount() == 0) {
            return false;
        }

        return $query_prepared->fetchColumn();
    }
795705
public function getStructure($mailbox, $id, $is_uid = false)
    {
        $result = $this->fetch($mailbox, $id, $is_uid, array('BODYSTRUCTURE'));

        if (is_array($result)) {
            $result = array_shift($result);
            return $result->bodystructure;
        }

        return false;
    }
820182
public function loadByCustomerEmail($email, $websiteId)
    {
        $customer = $this->getCollection()
            ->loadByCustomerEmail($email, $websiteId);

        if ($customer) {
            return $customer;
        } else {
            return $this->setEmail($email)
                ->setWebsiteId($websiteId);
        }
    }
723652
protected function getMessageHeader($id) {
        $count = $this->countMessages();
        for ($i=1;$i<=$count;$i++) {
            $uid = imap_uid($this->imap, $i);
            if ($uid==$id) {
                $header = imap_headerinfo($this->imap, $i);
                return $header;
            }
        }
        return false;
    }
492275
protected function _getUid($mailbox)
    {
        $query = $this->_baseSql($mailbox);
        $query[0] = 'SELECT d.messageid ' . $query[0];

        try {
            return $this->_db->selectValue($query[0], $query[1]);
        } catch (Horde_Db_Exception $e) {
            return null;
        }
    }
701566
public function findUserIdByEmail($email) {
        $userId = DB::table('users')
            ->where('email', $email)
            ->value('id')
        ;

        if (!$userId) {
            return 0;
        }

        return $userId;
    }
1329670
public function updateEmailContent($emailId, $args = array(), $returnRaw = false)
    {
        $args['id'] = $emailId;

        return $this->getResult('updateEmailContent', $args, false, $returnRaw);
    }
536113
public function deleteEmail( $email_id = null ) {
		if ( ! $email_id ) {
			$this->assertNotEmpty( $this->_current_email, 'The current email is not selected' );
			$email_id = $this->_current_email['id'];
		}

		$this->_send_delete_request( '/messages/' . $email_id );
	}
661426
public function get_by_email( $email, $args = array() ) {

		$this->set_request_args( array(
			'method' => 'GET',
			'path'   => array( 'email', urlencode( $email ) ),
			'params' => $args,
		) );

		return $this->do_request();
	}
733053
public function convertInviteEmails($email, $user_id)
	{
		// @FIXME: Should wrap this up in a nice transaction to handle partial failures and
		// race conditions.

		if (empty($email) || empty($user_id))
		{
			return false;
		}

		$db = \App::get('db');

		$sql = 'SELECT gidNumber FROM `#__xgroups_inviteemails` WHERE email=' . $db->quote($email) . ';';

		$db->setQuery($sql);

		$result = $db->loadColumn();

		if ($result === false)
		{
			return false;
		}

		if (empty($result))
		{
			return true;
		}

		foreach ($result as $r)
		{
			$values .= "($r,$user_id),";
			$gids   .= "$r,";
		}

		$values = rtrim($values, ',');
		$gids = rtrim($gids, ',');

		$sql = 'INSERT INTO `#__xgroups_invitees` (gidNumber,uidNumber) VALUES ' . $values . ';';

		$db->setQuery($sql);

		$result = $db->query();

		if (!$result)
		{
			return false;
		}

		$sql = 'DELETE FROM `#__xgroups_inviteemails` WHERE email=' . $db->quote($email) . ' AND gidNumber IN (' . $gids . ');';

		$db->setQuery($sql);

		$result = $db->query();

		if (!$result)
		{
			return false;
		}

		return true;
	}
1030488
public function trigger( $order_id ) {
		$order = wc_get_order( $order_id );
		if ( ! $order || ! $this->is_enabled() ) {
			return;
		}
		$reason = get_post_meta( $order->id, '_hametwoo_cancel_reason', true );
		if ( ! $reason ) {
			// Don't send with no reason.
			return;
		}
		$this->object = $order;
		$this->recipient = $this->object->billing_email;
		// Is html?
		foreach ( [
			'order_number' => $order->get_order_number(),
		    'order_date'   => date_i18n( get_option( 'date_format' ) ),
		] as $find => $result ) {
			$this->find[ $find ] = "{{$find}}";
			$this->replace[ $find ] = $result;
		}
		$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
	}
202368
public function inviteTeamMember($id_or_email)
    {
        $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id';

        $response = $this->rest->post(
            static::TEAM_ADD_MEMBER_PATH,
            array($key => $id_or_email)
        );

        $this->checkResponse($response);

        return new Team($response);
    }
1372620
public function getMailContent(int $character_id, int $from) : Builder
    {

        return MailHeader::with('body', 'recipients', 'sender')
            ->where('character_id', $character_id)
            ->where('from', $from)
            ->groupBy('mail_id');

    }