Avoraa
Avoraa

Reputation: 95

How sendgrid work without email password?

I use this tutorial Microsoft Email Configuration for .net Core,

Everything works correctly, something I wonder. In the traditional smtp setup we were specifying the password along with the email, why doesn't the SendGrid system require a password for email?

Traditional smtp setup we enter password with email as below.

var smtpClient = new SmtpClient
{
    Host = "smtp.gmail.com", // set your SMTP server name here
    Port = 587, // Port 
    EnableSsl = true,
    Credentials = new NetworkCredential("[email protected]", "password")
};

But I didn't understand this tutorial SendGrid does not want password just only want mail adress.

var client = new SendGridClient(apiKey);
var msg = new SendGridMessage()
{
   From = new EmailAddress("[email protected]", "Joe Smith"),
   Subject = subject,
   PlainTextContent = message,
   HtmlContent = message
};
msg.AddTo(new EmailAddress(email));

Another question, If I changed email name ("[email protected]") and send email, The message sends by Joe. If I change the email address to microsoft, it sends email on behalf of microsoft why ?.

From = new EmailAddress("[email protected]", "Joe Smith"),

or

From = new EmailAddress("[email protected]", "Microsoft"),

Okay I know SendGridKey stores SendGrid Api key but what does "SendGridUser" do ?

public class AuthMessageSenderOptions
{
    public string SendGridUser { get; set; }
    public string SendGridKey { get; set; }
}

Thanks.

Upvotes: 0

Views: 596

Answers (1)

rkengler
rkengler

Reputation: 446

The API key that you're using to connect is unique to you. This is why it should be kept secret. Sendgrid identifies you through the API key instead of an email/password combination.

Upvotes: 1

Related Questions