我正在使用googleAPI和Nodjs通过oauth2.0详细获取邮件。但是我没有获得带有图像附件格式的电子邮件签名。什么是API来获取带有图像附件格式的签名的电子邮件?
答案 0 :(得分:0)
Test class :-
@RunWith(SpringRunner.class)
@WebAppConfiguration
@SpringBootTest(classes=AuthServiceApplication.class)
public class ControllerTest {
@Autowired
private WebApplicationContext wac;
@Autowired
private FilterChainProxy springSecurityFilterChain;
@Autowired
private UserController accountController;
@MockBean
private UserService userService;
private MockMvc mockMvc;
private static final String CLIENT_ID = "inventory-service";
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).addFilter(springSecurityFilterChain).build();
}
@Test
public void shouldGive200_status()throws Exception {
String accessToken = obtainAccessToken("akash69tiwari@gmail.com", "password");
mockMvc.perform(get("/uaa/user/current").header("Authorization", "Bearer "+accessToken)).andExpect(status().isOk());
}
Controller class:-
@RestController
public class UserController {
private final Logger LOGGER= LoggerFactory.getLogger(getClass());
public static final String ROLE_USER = "ROLE_USER";
@RequestMapping(value="user/current",method=RequestMethod.GET)
public Principal getUser(Principal principal) {
return principal;
}
I have tried the same thing with postman and it is working just fine.
的下载链接。如果您记录以原始格式检索到的邮件正文(出于隐私原因,域名和文件ID替换为XXX),则您将获得响应的摘要:
img src
请记住,URL是引用的可打印编码的。您需要删除换行符Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><img src=3D"htt=
ps://drive.google.com/a/XXXXXXXXXXXXXXXXX/uc?id=3DXXXXXXXXXXXXXXXXXX=
sYV-&export=3Ddownload"><br></div></div></div></div>
,并将=
替换为=3D
,以获得正确的网址-类似于
=
您可以在浏览器中打开此链接,也可以通过获取消息的正文部分(对https://drive.google.com/a/XXXXXXXXXXXXXXXXX/uc?id=XXXXXXXXXXXXXXXXXXsYV-&export=download
进行过滤)并提取链接来以编程方式对其进行访问,例如带有正则表达式的表达式。