LogMeIn Rescue API User Guide

generateEmailText

Generates the Subject, Text, Link and Signature of a standard connection email based on Administration Center settings. The link contains the download URL for the Applet with the specified PIN code. For information about starting a session via email, see How to Start a Session via Email in the LogMeIn Rescue Technician Console User Guide.

Important: The maximum number of calls to this endpoint is limited to a single call per second to prevent malicious email flooding.

Input Parameters

Element Description
pincode The PIN code of the technician session, which must be 6-digit long. Required.
authcode The secret authentication code that is used to authenticate the user without logging in to Rescue. Optional.

Output

OK SUBJECT:Connection email link TEXT:Please click the link below to request a live support 
session: LINK:http://yourorganization.com/R?i=2&Code=123456 SIGNATURE:Best Regards, Support Team
SUBJECT: Email subject
TEXT: Email body
LINK: Link to the support PIN code
SIGNATURE: Email signature

Return Values

Displayed Return Value Description
ERROR
  • An unspecified error occurred, such as timeout.
  • The maximum allowed call rate of a single call per second has been exceeded.
OK An email was successfully generated.
NOTLOGGEDIN An email was not generated because the current user is no longer logged in.
NOTTECHNICIAN The API user is not a technician, so he cannot initiate a private session.
INVALID_SECRETAUTHCODE The secret authentication code for the user is invalid.
USER_DELETED_OR_DISABLED The user is deleted or disabled.
INVALIDPINFORMAT The format of the PIN code in the email is incorrect.

Sample Code

The following are examples for using the generateEmailText method that you can call in your environment.

HTTP GET

https://secure.logmeinrescue.com/API/generateEmailText.aspx?pincode=123456
&authcode=4ahx...80u0

HTTP POST

<form method="post" action="https://secure.logmeinrescue.com/API/generateEmailText.aspx">
        <input name="pincode" value="123456">
        <input name="authcode" value="4ahx...80u0">
</form>

SOAP

For sample SOAP 1.1 and SOAP 1.2 request and response messages, visit https://secure.logmeinrescue.com/api/API.asmx?op=generateEmailText.

PHP with SOAP

The example values shown must be replaced with actual values.

<?php
$soapclient = new SoapClient("https://secure.logmeinrescue.com/api/api.asmx?wsdl");

//define parameters
$loginparams = array (
'sEmail' => 'some@email.com',
'sPassword' => 'secretPassword'
);

//login
$loginResult = $soapclient->login($loginparams);

//print the result
echo "<b>Login full response.</b><br />";		//formatting
print_r($loginResult);
echo "<br /><br />";					//formatting

//set customer info
//you would normally do this via a form or dynamically from your CRM
$sCField0 = "some customer";
$sCField1 = "first custom field";
$sCField2 = "second custom field";
$sCField3 = "third custom field";
$sCField4 = "fourth custom field";
$sCField5 = "fifth custom field";
$sTracking0 = $sCField0 . date("c");			//to ensure unique 
$bNoTech = true;  //specifies whether Technician Console must be running

//create params array for SOAP request
$requestPINCodeParams = array(
'sCField0' => $sCField0,
'sCField1' => $sCField1,
'sCField2' => $sCField2,
'sCField3' => $sCField3,
'sCField4' => $sCField4,
'sCField5' => $sCField5,
'sTracking0' => $sTracking0,
'bNoTechConsole' => $bNoTech
);

$requestPINCodeResult = $soapclient->requestPINCode($requestPINCodeParams);

//print out the PIN Code full response
print_r("<b>requestPINCode full response.</b><br />");
print_r($requestPINCodeResult);
echo "<br /><br />";					//formatting

//show the PIN code only
$PINCode = $requestPINCodeResult["iPINCode"];
$sAuthCode = "";

//print PIN Code
print_r("<b>PIN Code.</b><br />");
print_r($PINCode);
echo "<br /><br />";					//formatting

//generate email text
//create array for email text request
$pin = array(
'iPINCode' => $PINCode,
'sAuthCode' => $sAuthCode
);

$emailtext = $soapclient->generateEmailText($pin);

//show the full email text response
print_r("<b>generateEmailText full response.</b><br />");
print_r($emailtext);

//email text formatted
print_r("<b>Formatted email text.</b><br />");
print_r($emailtext["sSubject"] . "<br /><br />");
print_r($emailtext["sText"] . "<br /><br />");
print_r($emailtext["sLink"] . "<br /><br />");
print_r($emailtext["sSignature"]);

?>

C# with HttpWebRequest

The example values shown must be replaced with actual values.

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <% 
     string sEndpoint = "https://secure.logmeinrescue.com/API/";  //add actionName.aspx? 
for each action called
     string sEmail = "some@email.com";
     string sPwd = "secretPassword";
     string sAuthCode = "";

     //set up the request
     HttpWebRequest oReq = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
 + "login.aspx" + "?email=" + sEmail + "&pwd=" + sPwd);
    
     //create a cookie container to store the cookies for this session 
     oReq.CookieContainer = new CookieContainer();
     
     
     //get the response
     HttpWebResponse oResp = (HttpWebResponse)oReq.GetResponse();

string sResp = new StreamReader(oResp.GetResponseStream()).ReadToEnd();
Response.Write("Login result: " + sResp + "<br />");  //You can customize the response

/*
//debug cookies
foreach (Cookie cook in oResp.Cookies)
{
Response.Write("Cookie:" + "<br />");
Response.Write("Name: " + cook.Name + " " + "Value: " + cook.Value + "<br />");
Response.Write("Domain: " + cook.Domain + "<br />");
Response.Write("Path: " + cook.Path + "<br />");
Response.Write("Port: " + cook.Port + "<br />");
Response.Write("Secure: " + cook.Secure + "<br />");

Response.Write("When issued: " + cook.TimeStamp + "<br />");
Response.Write("Expires: " + cook.Expires + " " + "Expired? " + cook.Expired + "<br />");
Response.Write("Don't save: " + cook.Discard + "<br />");
Response.Write("Comment: " + cook.Comment + "<br />");
Response.Write("Uri for comments: " + cook.CommentUri + "<br />");
Response.Write("Version: RFC " + cook.Version + "<br />");
    
// Show the string representation of the cookie.
Response.Write("String: " + cook.ToString());
}*/
     
//add cookies to cookie container
CookieContainer sessioncookie = oReq.CookieContainer;

     //get the EmailText info
HttpWebRequest oReqEmailText = (HttpWebRequest)System.Net.WebRequest.Create(sEndpoint
 + "generateEmailText.aspx?pincode=" + iPIN + "&authcode=" + sAuthCode);
oReqEmailText.CookieContainer = sessioncookie;

HttpWebResponse oRespEmailText = (HttpWebResponse)oReqEmailText.GetResponse();
string sRespEmailText = new StreamReader(oRespEmailText.GetResponseStream()).ReadToEnd();
Response.Write("requestEmailText result: " + sRespEmailText + "<br />");  //You can customize
 the response

%>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Rescue API generateEmailText Test</title>
</head>
<body>

</body>
</html>

C# with SOAP

The example values shown must be replaced with actual values.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using apiSamples.WebServiceClients;

namespace apiSamples
{
    public partial class SOAP : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                WebServiceClients.API proxy = new WebServiceClients.API();
                proxy.CookieContainer = new CookieContainer();

                string sEmail = "some@email.com";
                string sPwd = "secretPassword";
                string sAuthCode = "4ahx...80u0";
                int iPIN;
                string sSubject;
                string sText;
                string sLink;
                string sSignature;

                WebServiceClients.loginRet oLogin = proxy.login(sEmail, sPwd);
                Response.Write(oLogin + "<br />");

                WebServiceClients.requestPINCodeRet oRequestPIN = 
proxy.requestPINCode("", "", "", "", "", "", "", true, sAuthCode, out iPIN);
                Response.Write(oRequestPIN + "<br />");

                WebServiceClients.generateEmailTextRet oEmailText = proxy.generateEmailText
(iPIN, sAuthCode, out sSubject, out sText, out sLink, out sSignature);
                Response.Write(oEmailText + "<br />");

                Response.Write("Subject: " + sSubject + "<br />Body: " + sText +
 "<br />Link: " + sLink + "<br />Signature: " + sSignature);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}