in src/WebJobs.Extensions.SendGrid/Bindings/SendGridMessageAsyncCollector.cs [29:50]
public Task AddAsync(SendGridMessage item, CancellationToken cancellationToken = default(CancellationToken))
{
if (item == null)
{
throw new ArgumentNullException("item");
}
SendGridHelpers.DefaultMessageProperties(item, _options, _attribute);
if (!SendGridHelpers.IsToValid(item))
{
throw new InvalidOperationException("A 'To' address must be specified for the message.");
}
if (item.From == null || string.IsNullOrEmpty(item.From.Email))
{
throw new InvalidOperationException("A 'From' address must be specified for the message.");
}
_messages.Enqueue(item);
return Task.CompletedTask;
}