• satish kumar 498
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi, i am new to salesforce i am creating pdf attatchment with sending mail...... i get this answer,please help me for this,my code is

public class MyAttatchment {
Account acc;
    public String myName{set;get;}
    public MyAttatchment(){
        acc =[select Id,Name from Account where Name=:myName limit 1];
    }
    public void pageReferenceShow(){
        Messaging.SingleEmailMessage myMail = new Messaging.SingleEmailMessage();
        Messaging.EmailFileAttatchment fMail = new Messaging.EmailFileAttatchment();
         pageReference pdf = page.Attatchment.pdf;
        pdf.getParameters().put(Id,(String.accId));
        pdf.setRedirect(true);
        Blob b =pdf.getContent();
        fMail.setFileName('Attatchment.pdf');
        fMail.setBody(b);
        myMail.setSubject('MonthBill');
        String toAdd = new String[]{'n.satti534@gmail.com'};
            myMail.setToAddress(toAdd);
        myMail.setBody('Plz Find Attatchment');
        myMail.setFileAttachments( new Messaging.EmailFileAttatchment[]{fMail});
        Messaging.sendEmail(new Messaging.Email[]{myMail});
        return null;
        
    }
}

i get error like this..invalid type:messaging.emailfileattatchment