• Vasundhara Vaishnav
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Extentia Information Technology Pvt. Ltd

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have read that with Spring 14, Email to Post to Chatter Groups is Generally Available. Users can post to groups by sending emails from the email address associated with their Salesforce account. Please refer below link for more information:

https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-allow-users-to-post-to-Chatter-Groups-via-Email&language=en_US

I have configured it for my organization and I am able to post to chatter group by sending an email from my mailbox directly.

Now, I am trying to post to chatter by sending an email through apex code. And here problem comes. No error is occurring but Content is also not getting posted to chatter group.

Below is my apex code:

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
    String emailSubject = 'Test email subject';
    String[] toAddresses = new String[] {[toemailaddress]}; 
    mail.setToAddresses(toAddresses); 
    mail.setBccSender(true);
    mail.setSubject(emailSubject);
    mail.setSenderDisplayName('License');
    String mailBody = 'Mail sent from apex class';

    mail.setPlainTextBody(mailBody);   
    mail.setSaveAsActivity(false);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});

In the above code, If I replace [toemailaddress] to some gmail/yahoo, or other valid email address, then mail is getting sent. But If I replace [toemailaddress] to my chatter group email address which is something like this "0f990000000llhpcak@post.9-vxv6eam.ap1.chatter.salesforce.com", then mail is not getting sent.

Can anyone has any idea how can I achieve this through apex code?

My main requirement is that I always want to post my content in production's chatter no matter I am on INT, QA or UAT. That's why I have chosen "Post By Email" feature which is released in Spring 14. But unfortunately, I am not able to achieve the same through apex code. 
Hi,

We currently have a Visualforce profile subtab on our User's Chatter profile in Classic which we want to migrate to the Lightning experience however, we have not been able get this to show. Does anyone have any experience of making these show in Lightning?
I have read that with Spring 14, Email to Post to Chatter Groups is Generally Available. Users can post to groups by sending emails from the email address associated with their Salesforce account. Please refer below link for more information:

https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-allow-users-to-post-to-Chatter-Groups-via-Email&language=en_US

I have configured it for my organization and I am able to post to chatter group by sending an email from my mailbox directly.

Now, I am trying to post to chatter by sending an email through apex code. And here problem comes. No error is occurring but Content is also not getting posted to chatter group.

Below is my apex code:

    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 
    String emailSubject = 'Test email subject';
    String[] toAddresses = new String[] {[toemailaddress]}; 
    mail.setToAddresses(toAddresses); 
    mail.setBccSender(true);
    mail.setSubject(emailSubject);
    mail.setSenderDisplayName('License');
    String mailBody = 'Mail sent from apex class';

    mail.setPlainTextBody(mailBody);   
    mail.setSaveAsActivity(false);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});

In the above code, If I replace [toemailaddress] to some gmail/yahoo, or other valid email address, then mail is getting sent. But If I replace [toemailaddress] to my chatter group email address which is something like this "0f990000000llhpcak@post.9-vxv6eam.ap1.chatter.salesforce.com", then mail is not getting sent.

Can anyone has any idea how can I achieve this through apex code?

My main requirement is that I always want to post my content in production's chatter no matter I am on INT, QA or UAT. That's why I have chosen "Post By Email" feature which is released in Spring 14. But unfortunately, I am not able to achieve the same through apex code.