P
P
Pavel2422015-10-30 11:29:39
Computer networks
Pavel242, 2015-10-30 11:29:39

Is it possible to perform an http request in common mail services?

They asked me to find out if, after sending a letter to a mailbox (for example, gmail), it is possible to perform an http request to another site using the mail site itself?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2015-10-30
@Pavel242

In Google Docs, you can create a table to which you can attach a Googlescript, which will process all new letters according to the "crown" (configured in the gs editor). For example, such a notification on sms works for me.

function my_notification() 
{  
  var labels = GmailApp.getUserLabelByName('SMSnotify');
  
  if(labels){
    
    var threads = labels.getThreads(); 
    
    if(threads.length > 0){
    
      for(i in threads){
        
        var text = threads[i].getFirstMessageSubject();
        
        if(text[0] == 'R' && text[1] == 'e' && text[2] == ':'){
          text = text.substring(3);
        }
        text = text.trim();
        
        var maxLetters = ( /^[a-zA-Z0-9\s\^\[\]\(\)\/\*\+\-\=\|\{\}\%\,\$\#\@\&\!\?\.\,\`\~\;\:\_\<\>\"]*$/.test(text) ? 160 : 70 ) - 12;
        
        text = text.substring(0,maxLetters).trim();
    
        UrlFetchApp.fetch('http://sms.ru/sms/send?...........&text=' + encodeURIComponent(text));//тут синхронный запрос к sms.ru
      }
      
      labels.removeFromThreads(threads); //снимаем метки "SMSnotify" с цепочек
    }
  }
}

The "SMSnotify" label is attached to all new emails addressed directly to me in the gmail filter settings.

A
Andrew, 2015-10-30
@R0dger

Well, directly, no. What is your task?
You can put the so-called pixel (link to the picture on your server) in the letter.
when a user opens this letter in a browser or mail client, a request will be made to your server, and on it you can already count the user, or something else ... you get a simple GET request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question