Solved

Translate to english a received email

Posted on 2009-05-15
5
346 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 300 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

729 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