https://github.com/mailslurp/examples
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=79a48c4f_002D4629_002D4d38_002D9fd5_002D5f9ac5f3452a/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from UnitTest1.vb" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
<ProjectFile>B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41/f:UnitTest1.vb</ProjectFile>
</SessionState></s:String></wpf:ResourceDictionary>
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "visualbasic", "visualbasic\visualbasic.vbproj", "{B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B463FEBD-FB6E-4E33-8E2E-A1D0D706CE41}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
# Email testing
See [examples repository](https://github.com/mailslurp/examples) for source.
test:
dotnet test
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>
</Project>
Imports NUnit.Framework
Namespace visualbasic
Public Class Tests
<SetUp>
Public Sub Setup()
End Sub
<Test>
Public Sub Test1()
'<gen>vb_setup_slurp
Dim webClient As New Net.WebClient
Dim jsonClient As New Net.WebClient
Dim apiKey As String = Environment.GetEnvironmentVariable("API_KEY")
Assert.IsNotEmpty(apiKey)
Assert.IsNotNull(apiKey)
webClient.Headers.Add("x-api-key", apiKey)
Dim imapSmtpAccessJson = webClient.DownloadString("https://api.mailslurp.com/inboxes/imap-smtp-access")
jsonClient.Headers.Add("Content-Type", "application/json")
Dim username = jsonClient.UploadString("https://api.mailslurp.com/user/json/pluck?property=smtpUsername", imapSmtpAccessJson)
jsonClient.Headers.Add("Content-Type", "application/json")
Dim password = jsonClient.UploadString("https://api.mailslurp.com/user/json/pluck?property=smtpPassword", imapSmtpAccessJson)
jsonClient.Headers.Add("Content-Type", "application/json")
Dim port = jsonClient.UploadString("https://api.mailslurp.com/user/json/pluck?property=smtpServerPort", imapSmtpAccessJson)
jsonClient.Headers.Add("Content-Type", "application/json")
Dim host = jsonClient.UploadString("https://api.mailslurp.com/user/json/pluck?property=smtpServerHost", imapSmtpAccessJson)
'</gen>
Dim inboxResult = webClient.DownloadString("https://api.mailslurp.com/inboxes/paginated?page=0&size=1")
jsonClient.Headers.Add("Content-Type", "application/json")
Dim emailAddress = jsonClient.UploadString("https://api.mailslurp.com/user/json/pluck?property=content.0.emailAddress", inboxResult)
Assert.IsNotNull(emailAddress)
Assert.AreEqual(emailAddress, "213")
Dim toAddress = emailAddress
Dim fromAddress = emailAddress
'<gen>vb_configure_smtp
Dim Smtp_Server As New Net.Mail.SmtpClient
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential(username, password)
Smtp_Server.EnableSsl = False
Smtp_Server.Port = Integer.Parse(port)
Smtp_Server.Host = host
'</gen>
'<gen>vb_send_email
Dim email As New Net.Mail.MailMessage()
email = New Net.Mail.MailMessage()
email.From = New Net.Mail.MailAddress(fromAddress)
email.To.Add(toAddress)
email.Subject = "Send email with VB"
email.IsBodyHtml = False
email.Body = "Hello this is me"
Smtp_Server.Send(email)
'</gen>
End Sub
End Class
End Namespace
bin
obj