替代html中的锚标记

时间:2016-08-22 07:09:09

标签: html asp.net html5 email

我目前正在asp.net发送邮件。

我做到了。

class Connection: public boost::enable_shared_from_this<Connection>
{
public:
    Connection(boost::asio::io_service& io) : _socket(io){}

    void connect(tcp::resolver::iterator& point)
    {
        boost::asio::async_connect(_socket, point, boost::bind(&Connection::onConnected, this, boost::asio::placeholders::error));
    }

    void onConnected(const boost::system::error_code& ErrorCode)
    {
        std::cout << "You are connected" << std::endl;

        // receive first message on onReceive
        boost::asio::async_read_until(_socket,
            _buffer,
            '\n',
            boost::bind(&Connection::onReceive,
              this, boost::asio::placeholders::error));
    }

    void onSend(const boost::system::error_code& ErrorCode, std::size_t bytes_transferred)
    {
        std::cout << "Sending..." << std::endl;
    }

    void onReceive(const boost::system::error_code& ErrorCode)
    {
        std::cout << "You received the following message from the server:" << std::endl;
        //std::cout.write(_buffer.data(), bytes_transferred);

        // send first message on onSend
        m_message = make_daytime_string() + '\n';
        std::cout << "Sending " << m_message << std::endl;
        boost::asio::async_write(_socket, boost::asio::buffer(m_message), boost::bind(&Connection::onSend, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
    }

    tcp::socket& getSocket()
    {
        return _socket;
    }
private:
    tcp::socket _socket;
    boost::asio::streambuf _buffer;
    std::string m_message;
};

此外,我想在此附加一个链接,该链接将作为链接显示在邮件中,并将重定向到移动屏幕。所以一定不是简单的文字。

mailMessage.IsBodyHtml = true;

但它不会显示为链接,然后我将链接设为。

<a href = \"com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "\" >com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "</a>

它显示为链接,但移动开发者无法处理<a href = \"http://com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "\" >com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "</a> 所以任何替代锚标记?

1 个答案:

答案 0 :(得分:1)

拉娜,我想你是以正确的方式做的。请查看以下这些文章的更多内容。

link from HTML href to native app

Android Custom URL to open App like in iOS

我不知道您的移动应用正在运行哪个平台。下面是android的意图示例。

<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/gizmos" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="example"
          android:host="gizmos" />

</intent-filter>

以下XML代码段显示了如何在清单中为深层链接指定intent过滤器。 URI“example:// gizmos”和“http://www.example.com/gizmos”都解析为此活动。

因此,在阅读后我的理解,com.myapp ...和http://com.myapp ...都受支持,但这取决于您的配置。