Skip to main content
added 15 characters in body
Source Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and mail id of the user showing, what's the value of what you're passing into setSenderDisplayname()? I copied and pasted your code and was able to see it display correctly. Be aware it's still using the user's email address from Salesforce to send from, it's just the display name that's changing.

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'your test email here' };
message.optOutPolicy = 'FILTER';
message.setSenderDisplayName('Testing Display Name');
message.subject = 'This is my test';
message.setHtmlBody('emailFinalBody');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

enter image description here

For the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match.

I would test in Outlook or another service to confirm it looks as you want as well. For getting rid of the gmail part, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and mail id of the user showing, what's the value of what you're passing into setSenderDisplayname()? I copied and pasted your code and was able to see it display correctly

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'your test email here' };
message.optOutPolicy = 'FILTER';
message.setSenderDisplayName('Testing Display Name');
message.subject = 'This is my test';
message.setHtmlBody('emailFinalBody');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

enter image description here

For the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match.

I would test in Outlook or another service to confirm it looks as you want as well. For getting rid of the gmail part, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and mail id of the user showing, what's the value of what you're passing into setSenderDisplayname()? I copied and pasted your code and was able to see it display correctly. Be aware it's still using the user's email address from Salesforce to send from, it's just the display name that's changing.

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'your test email here' };
message.optOutPolicy = 'FILTER';
message.setSenderDisplayName('Testing Display Name');
message.subject = 'This is my test';
message.setHtmlBody('emailFinalBody');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

enter image description here

For the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match.

I would test in Outlook or another service to confirm it looks as you want as well. For getting rid of the gmail part, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

added 15 characters in body
Source Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and mail id of the user showing, what's the value of what you're passing into setSenderDisplayname()? I copied and pasted your code and was able to see it display correctly

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'your test email here' };
message.optOutPolicy = 'FILTER';
message.setSenderDisplayName('Testing Display Name');
message.subject = 'This is my test';
message.setHtmlBody('emailFinalBody');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

enter image description here

For the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match. I believe this should go away if you reply to the email in gmail and receive another.

I would test in Outlook or another service to confirm it looks as you want as well. If replying toFor getting rid of the email doesn't fix it in gmail part, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match. I believe this should go away if you reply to the email in gmail and receive another.

I would test in Outlook or another service to confirm it looks as you want as well. If replying to the email doesn't fix it in gmail, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and mail id of the user showing, what's the value of what you're passing into setSenderDisplayname()? I copied and pasted your code and was able to see it display correctly

Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
message.toAddresses = new String[] { 'your test email here' };
message.optOutPolicy = 'FILTER';
message.setSenderDisplayName('Testing Display Name');
message.subject = 'This is my test';
message.setHtmlBody('emailFinalBody');
Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage> {message};
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

enter image description here

For the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match.

I would test in Outlook or another service to confirm it looks as you want as well. For getting rid of the gmail part, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

added 15 characters in body
Source Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match. I believe this should go away if you reply to the email in gmail and receive another.

I would test in Outlook or another service to confirm it looks as you want as well. If replying to the email doesn't fix it in gmail, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match. I believe this should go away if you reply to the email in gmail and receive another.

I would test in Outlook or another service to confirm it looks as you want as well. If replying to the email doesn't fix it in gmail, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Florian's comment explains that the "Sandbox" prefix will disappear in Production.

For the senderDisplayName and the via url part, this knowledge article explains why this is a gmail issue and not a Salesforce issue.

This is a security feature set by Gmail which displays the full email address of the sender as the name doesn't match. I believe this should go away if you reply to the email in gmail and receive another.

I would test in Outlook or another service to confirm it looks as you want as well. If replying to the email doesn't fix it in gmail, I would defer to the article for the two options below:

  1. As mentioned in the Google article following a best practice of using

DKIM signing Create a DKIM Key in Salesforce combined with an SPF Sender Policy Framework (Sender Policy Framework (SPF) and Salesforce SPF Records) entry for Salesforce MTA IPs in the senders DNS should resolve the problem.

  1. Another alternative could be to disable following email deliverability settings in Salesforce to remove the *bnc.salesforce.com from the

sender domain.

-Activate bounce management

-Enable compliance with standard email security mechanisms

Source Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72
Loading