Solved

Translate to english a received email

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now