+ Start a Discussion
vibrationvibration 

when clicking a button, mail will send correspondind address.(vf code)

invoice num

price

 

when clicking a button, mail will send correspondind address.

 

plz explain step by step

 

1)Vf code

2)class file

Best Answer chosen by Admin (Salesforce Developers) 
Hari@RockzsHari@Rockzs

Hi,

 

Public class sendmail()

{

  String sendpassword(mailid,password)

   {

               Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();

              String[] toAddresses =new String[] {mailid};

              Mail.setToAddresses(toAddresses);

               Mail.setReplyTo(‘community@gmail.com’);

               Mail.setSenderDisplayName(‘LMS Support  U R Password  is……..’);

               Mail.setSubject(‘U r LMS Password is sent,check u r mail’);

               Mail.setBccSender(false);

               Mail.setUseSignature(false);

               Mail.setPlainTextBody(‘ We r from LMS,U r LMS Password is:’+password);

               Mail.setHtmlBody(‘ LMS Password is:<b>’+ password +’</b>’);

               Messaging.sendEmail(new  Messaging.SingleEmailMessage[] {Mail});

}

}

 

 

Vfpage

 

<apex:commandButton  value="send" Action={!sendmail}>

All Answers

Hari@RockzsHari@Rockzs

Hi,

 

Public class sendmail()

{

  String sendpassword(mailid,password)

   {

               Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();

              String[] toAddresses =new String[] {mailid};

              Mail.setToAddresses(toAddresses);

               Mail.setReplyTo(‘community@gmail.com’);

               Mail.setSenderDisplayName(‘LMS Support  U R Password  is……..’);

               Mail.setSubject(‘U r LMS Password is sent,check u r mail’);

               Mail.setBccSender(false);

               Mail.setUseSignature(false);

               Mail.setPlainTextBody(‘ We r from LMS,U r LMS Password is:’+password);

               Mail.setHtmlBody(‘ LMS Password is:<b>’+ password +’</b>’);

               Messaging.sendEmail(new  Messaging.SingleEmailMessage[] {Mail});

}

}

 

 

Vfpage

 

<apex:commandButton  value="send" Action={!sendmail}>

This was selected as the best answer
vibrationvibration

Thanks.

 

a)when i click a button all the inventory details send to the corresponding address

plz send details