You need to sign in to do that
Don't have an account?

Using Triggers how can i send a mail?
Hi,
here is my code.Scenario is when a record is created on account object triggers then it will shoot mail.
trigger acctrig on Account (before insert) {
account a=trigger.new[0];
list<string> toaddress=new list<string>();
toaddress.add('shravankumabragam@yahoo.com');
String subject = 'Account Trigger';
String body = 'Hi, Account trigger has been fired,new account has been created.please check on Account object' ;
String Signature = 'B.Shravankumar';
Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
mail.setToAddresses(toaddress);
mail.setSenderDisplayName('Salesforce Outbound Notification');
mail.setsubject(subject);
mail.setplaintextbody(body);
mail.setuseSignature(true);
Messaging.sendEmail(new Messaging.singleEmailmessage[]{mail});
}
You haven't told us what's happening when this code executes - is there an error?
Hi,
When a record is created trigger is fired,but mail is not send
Hmm. I've used this in the past to send emails without problems. What happens if you turn on debug logging - do you see an email queued?