Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetFileMailWriter()

MailWriter System.Net.Mail.SmtpClient.GetFileMailWriter ( string pickupDirectory)
inlinepackage

Definition at line 370 of file SmtpClient.cs.

371 {
372 if (System.Net.NetEventSource.Log.IsEnabled())
373 {
374 System.Net.NetEventSource.Info(this, FormattableStringFactory.Create("{0}={1}", "pickupDirectory", pickupDirectory), "GetFileMailWriter");
375 }
376 if (!Path.IsPathRooted(pickupDirectory))
377 {
378 throw new SmtpException(System.SR.SmtpNeedAbsolutePickupDirectory);
379 }
380 string path2;
381 do
382 {
383 string path = $"{Guid.NewGuid()}.eml";
384 path2 = Path.Combine(pickupDirectory, path);
385 }
386 while (File.Exists(path2));
387 FileStream stream = new FileStream(path2, FileMode.CreateNew);
388 return new MailWriter(stream, encodeForTransport: false);
389 }
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static string Combine(string path1, string path2)
Definition Path.cs:304
static bool IsPathRooted([NotNullWhen(true)] string? path)
Definition Path.cs:985
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static FormattableString Create(string format, params object?[] arguments)
static string SmtpNeedAbsolutePickupDirectory
Definition SR.cs:102
Definition SR.cs:7

References System.IO.Path.Combine(), System.Runtime.CompilerServices.FormattableStringFactory.Create(), System.IO.File.Exists(), System.Net.NetEventSource.Info(), System.IO.Path.IsPathRooted(), System.Net.NetEventSource.Log, System.SR.SmtpNeedAbsolutePickupDirectory, and System.stream.

Referenced by System.Net.Mail.SmtpClient.Send(), and System.Net.Mail.SmtpClient.SendAsync().