英文:
Unable to catch email body with Cypress-Mailosaur
问题
这是电子邮件。它是HTML格式的,我正在尝试提取代码。
我得到了这个错误。
我只是添加了一个断言来检查我是否获取了电子邮件的正文,但错误显示为空白。
英文:
This the email. It is in HTML and I am trying to retrieve the code
I just put an assertion just to check if I am getting the body of the email but the error says it's ''
答案1
得分: 1
电子邮件通常分为两部分,一个是HTML部分,另一个是文本部分。这是为了在您在不支持HTML的设备上阅读电子邮件时(这种情况已经很少见了),可以显示文本版本。
回答您的问题:您需要更改您的代码,使用email.html.body而不是email.text.body,因为您没有电子邮件的文本版本。
您应该能够通过email.html.codes[0]来检索您的认证代码。
英文:
Emails typically have two parts, an html part and a text part. This is so that when you are reading an email on a device that doesn't support html (rare these days) the text version can be shown.
To answer your question: you need to change your code to use email.html.body rather than email.text.body as you don't have a text version of your email.
You should be able to retrieve your authentication code via email.html.codes[0] as well.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论