Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Translate to english a received email

Posted on 2009-05-15
5
Medium Priority
?
352 Views
Last Modified: 2013-11-27
Hi Guys

I have a site that is sending me emails in spanish, is there any way that i can create a rule that as soon as i receive an email from this sender, translate that email to english

Please advice
0
Comment
Question by:titorober23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24401427
titorober23,

<is there any way that i can create a rule that as soon as i receive an email from this sender, translate that email to english>
Sorry, No.
Most Outlook "rules" will specify what happens to an email, not manipulate what is inside of it.
Although you can specify Outlook to look at keywords in an email, I don't think there is an easy way for Outlook to "detect" the language, then translate the text in the body of the email.

However, a user at my company uses this product:
http://www.desktoptranslator.com/default-b.asp?linkID=1

It will translate the email once opened, thus achieving your ultimate goal of translating the email from spanish to english.

;-)

JeffCoachman
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24404302
Just don't expect miracles with the translation.  Sometimes the results can be unintentionally hilarious.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24404584
Hi, titorober23.

It is possible to translate a message using Google's translation API and a bit of scripting.  The output will be strictly plain-text though and some other formatting (e.g. carriage returns) will be lost.  I've only tested it with fairly short messages, so I don't know how it'll do if the message is very long.  I'll post the code if you're interested.

Another alternative is to use Outlook's built-in translation capability.  To use it

1.  Select the text you want to translate.
2.  Right-click and select Translate > Translate.
3.  Select the From and To languages.
0
 

Author Comment

by:titorober23
ID: 24417806
BlueDevilFan

Can you please post the code
0
 
LVL 76

Accepted Solution

by:
David Lee earned 1200 total points
ID: 24420119
Sure.  Here it is.  Follow these instructions to use it.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor
10. Create a rule that fires for these messages
11. Set the rule's action to "run a script" and select TranslateMessage as the script to run.

Here's how this works.

1.  When a message arrives Outlook runs rules.
2.  If the rule created in step 10 evaluates to true, then Outlook runs the script
3.  TranslateMessage calls te second script TranslateText
4.  TranslateText passes the message body to Google's language API asking it to translate from Spanish to English
5.  Google translates the message body and returns the Spanish text
6.  TranslateText returns the text to TranslateMessage which inserts it back into the original message

I don't have any messages in Spanish, so I tested by translating from English to Spanish.  It worked fine.  As noted above I don't know if there's a limit on the length of text that Google will translate.  

If you are interested in Google's language API visit: http://code.google.com/apis/ajaxlanguage/documentation/
Sub TranslateMessage(Item As Outlook.MailItem)
    Item.Body = "---- Translation ----" & vbCrLf & TranslateText(Item.Body) & vbCrLf & "---- End Translation ----" & vbCrLf & vbCrLf & Item.Body
    Item.Save
End Sub
 
Function TranslateText(strText As String) As String
    Dim objXMLHTTP As Object
    Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
    With objXMLHTTP
        .Open "GET", "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=" & Replace(strText, " ", "%20") & "&langpair=es%7Cen", False
        'Change the referer as desired.  This is a fake URL.'
        .setRequestHeader "REFERER", "http://www.mysite.com/index.html"
        .Send
        Do Until .readyState = 4
            DoEvents
        Loop
        intStart = InStr(1, .responseText, "translatedText")
        intEnd = InStr(intStart, .responseText, "}")
        TranslateText = Mid(.responseText, intStart + 17, (intEnd - 1) - (intStart + 17))
    End With
    Set objXMLHTTP = Nothing
End Function

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question