2012-08-27 2 views
0

Amazon Simple Email Service Java API를 사용하여 수신자에게 메일을 보내고 있습니다. 메일 본문 태그에 URL을 보내고 있습니다. 사용 사례에 따라 사용자가 수신 된 URL을 두 번 클릭하여 일부 조치를 취하도록 요청합니다. (확인 메일과 같이)인코딩없이 이메일에 url을 보내는 방법

수신하는 동안 URL이 인코딩되는 문제가 있습니다. 더블 클릭하면 페이지를 찾을 수 없습니다 (404) 오류가 발생합니다. 내가 AmazonSimpleEmailServiceClient을 사용하고 http://something.com/confirm/email=abc%40hotmail.com%26regKey=somekey%26confirm=true

:

원래 URL는 : 내가 메일에이 URL을 더블 클릭하면 같은 http://something.com/confirm/[email protected]&regKey=somekey&confirm=true , 링크는 주소 표시 줄에서 열립니다. 코드는 다음과 같습니다 :

그냥 발견

SendEmailRequest request = new SendEmailRequest().withSource(sourceAddress); 

String confirmationURL="http://something.com/confirm/[email protected]&regKey=somekey&confirm=true"; 

      List<String> toAddresses = new ArrayList<String>(); 
      toAddresses.add(toEmail); 

      Destination dest = new Destination().withToAddresses(toAddresses); 
      request.setDestination(dest); 

      Content subjContent = new Content().withData("Confirmation Request"); 
      Message msg = new Message().withSubject(subjContent); 

      // Include a body in both text and HTML formats 
      Content textContent = new Content().withData("Dear please go to the following URL:"+ 
        confirmationURL+"\n\n"); 

      Content htmlContent = new Content().withData("<p>Dear please go to the following URL:</p>"+ 
        "<p><a href=\""+confirmationURL+"\">"+confirmationURL+"</a></p>"); 

      Body body = new Body().withHtml(htmlContent).withText(textContent); 
      msg.setBody(body); 
      request.setMessage(msg) 

UPDATE받는 사람 이메일 hotmail.com에있을 때,이 문제는 발생한다. 왜 마이크로 소프트는 항상 다르게 뭔가를해야합니까? 누군가 도와주세요!

String confirmationURL = URLEncoder.encode("http://something.com/confirm/[email protected]&regKey=somekey& confirm=true", "UTF-8"); 

답변

0

는 클래스 java.net.URLEncoder를 사용합니다. 이미 인코딩 된 상태입니다.
+0

난 그냥 반대를하고 싶지 : – shashankaholic

+0

죄송합니다. URLDecoder.decode()가 트릭을 수행해야합니다. – JamesB

+0

실제로 인코딩은 핫메일 수신자에게 있습니다. 나는 그것을 디코딩 할 수 없다. – shashankaholic

관련 문제