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
mat_tone_84mat_tone_84 

sending email by visual basic 6

I have to send email to a contact with visual basic 6.

I don't want to use a standard smtp because I have to use template and attachment which are saved into SF.

I wrote a similar code in a trigger by apex, but now I want to write code in vb6, it is possibile?

I try to find on the discussion boards but I find only some post which say that it is impossibile send email through api.

 

This is the "easy" code which I use in a trigger :

 

 

trigger send_mail on Opportunity (before update) {
[...]
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'test@test.com'};
mail.setToAddresses(toAddresses );
mail.setReplyTo('replyto@test.com');
mail.setSenderDisplayName('sender@test.com');
mail.setSubject('subjcet');
mail.setPlainTextBody('texttt');
Attachment Att = [Select body, name from attachment where parent.id = 'xxx' and name like 'xxxx%'];
Messaging.EmailFileAttachment[] fileAttachments = new Messaging.EmailFileAttachment[1];
Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment();
mail.setTemplateId(my_template_id);
fileAttachment.setBody(Att.body);
fileAttachment.setFileName(Att.name);
fileAttachments[0] = fileAttachment;
mail.setFileAttachments(fileAttachments);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

}

 I think that I have to start with a declaration (dim messaging as new XXX ) of variabile, but the problem is : "what Have I to declare?"

in the dll exist only :

sobject3

sforcesession3

...

 

but i don't find anything about email,thanks

 

 

 

 

 

IraIra

I have been using an ActiveX: AddEmail from http://www.traysoft.com/index.htm

It will allow emails to be sent in HTML and with attachments.

Message Edited by Ira on 02-02-2010 11:54 AM
mat_tone_84mat_tone_84

Thanks for the software, but I solve in this way:

I don't find trigger's code

I create a vb program with smtp