function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
satish kumar 498satish kumar 498 

invalid type error

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
Andrew GAndrew G
Is the issue that there is a typo:

EmailFileAttachment