You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Redemption可靠获取发件人邮箱地址?

Fixing Empty SenderEmailAddress in Redemption RDOMail for SMTP/IMAP Accounts

I’ve dealt with this exact headache before—when new emails land in an SMTP/IMAP inbox via Redemption, the SenderEmailAddress property can sometimes come up empty temporarily. The standard Outlook interop workaround doesn’t translate directly to RDOMail, but Redemption has its own robust way to get the sender’s email address reliably.

Here’s the approach I use, which handles both newly arrived and existing emails, and works for all account types:

Step-by-Step Solution

Instead of relying solely on SenderEmailAddress, leverage Redemption’s Sender property (an RDOAddressEntry object) to extract the address. This object is populated earlier than the string-based SenderEmailAddress property, making it perfect for newly delivered messages.

Example Code (C#)

using Redemption;

string GetReliableSenderEmail(RDOMail mailItem)
{
    // First try the direct SenderEmailAddress property
    if (!string.IsNullOrWhiteSpace(mailItem.SenderEmailAddress))
    {
        return mailItem.SenderEmailAddress;
    }

    // Fall back to the RDOAddressEntry object
    var senderEntry = mailItem.Sender;
    if (senderEntry == null) return string.Empty;

    // Prioritize SMTP address if available
    if (!string.IsNullOrWhiteSpace(senderEntry.SmtpAddress))
    {
        return senderEntry.SmtpAddress;
    }

    // Handle Exchange users (if applicable)
    if (senderEntry.AddressEntryType is rdoAddressEntryType.olExchangeUserAddressEntry or rdoAddressEntryType.olExchangeRemoteUserAddressEntry)
    {
        var exchangeUser = senderEntry.ExchangeUser;
        return exchangeUser?.PrimarySmtpAddress ?? senderEntry.Address;
    }

    // Last resort: return the raw address (might be EX format for Exchange, but better than empty)
    return senderEntry.Address;
}

Key Details:

  • Why this works: Redemption’s RDOAddressEntry directly accesses the underlying MAPI properties that Outlook uses to store sender information, which are populated before the SenderEmailAddress string is formatted.
  • Null safety: Always check for nulls when accessing Sender or ExchangeUser to avoid runtime exceptions, especially for system-generated emails or messages with malformed sender data.
  • Compatibility: This works for all account types (SMTP, IMAP, Exchange) and across recent versions of Redemption.

Additional Tips

  • Ensure you’re using the latest version of Redemption—older builds had minor inconsistencies with address entry properties for SMTP accounts.
  • If you’re processing emails as they arrive (e.g., via a NewMailEx event), adding a small delay (1-2 seconds) can help edge cases, but the above method should eliminate the need for that in most scenarios.

内容的提问来源于stack exchange,提问作者Leon Zhou

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:17:11