4D Internet Commands v16Appendix E, Mocking network to file |
||
|
4D Internet Commands v16
Appendix E, Mocking network to file
Appendix E, Mocking network to file
Testing and debugging code that sends emails could be a pain; when an email is not received correctly, the source of the problem could be the network configuration, the provider, the client software, and so on. To help you in this case, we added the ability to dump email in a local file instead of sending it. With this feature, you just need to modify the resulting file slighlty to create an EML file that can display the results in MS Outlook. You can also include email files in unit-testing procedures. You can run the local code: $err:=SMTP_SetPrefs(0;15;0) // Body: UTF-8 & QuotedPrintable, Header: UTF-8 & Base64 This produces the following .txt file: <mail.sender@gmail.com> If you want to open this file as a standard MS Outlook email:
To comply with unit-testing mechanisms, when using SMTP_QuickSend with an output file, the Date header is always the following string: Date: Fri, 08 Jul 2016 16:45:24 +0200 In this case, date comparisons will not fail in unit tests. Note: When you use a real host (such as smtp.gmail.com), the date header gets replaced by an actual timestamp. If you want to have an actual timestamp in your test file, you can use this feature with SMTP_Send. In this case, you can use the SMTP_Date command and then provide an actual Date header with SMTP_Send.
|
PROPRIEDADES
Produto: 4D Internet Commands
HISTÓRIA
Criado por: 4D v16 ARTICLE USAGE
4D Internet Commands ( 4D Internet Commands v16) |