You are on page 1of 3

http://superuser.

com/questions/165978/how-to-extract-the-text-from-ms-office-
documents-in-linux

Michel Jul 15, 2011 3:12 AM (in response to user10634418)

This is the PeopleCode for sending an email (which you can find in the
PeopleBooks).
Incorporate this in your code and make sure you point the &MAIL_FILES variable to
the location of the file you want to send.
You can basically make the sender / receiver email address a variable as well which
you fill somewhere in your code.
>
&MAIL_FLAGS = 0;
&MAIL_TO = "test@test.com";
&MAIL_CC = "";
&MAIL_BCC = "";
&MAIL_FROM = "";
&REPLYTO = "";
&SENDER = "";

&MAIL_SUBJECT = "This is the subject";


&MAIL_TEXT = "This is the text in the email";
&MAIL_FILES = "C:\test.txt";
&MAIL_TITLES = "Test.txt";
&MAIL_SEP = ";";
&CONTTYPE = "";

&RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT,


&MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &CONTTYPE, &REPLYTO,
&SENDER);
If &RET <> 0 Then
Warning ("Email could not be sent!");
End-If;
>

&MAIL_FLAGS = 0;

&MAIL_TO = "uladdha@tva.gov";

&MAIL_CC = "";

&MAIL_BCC = "";

&MAIL_FROM = "noname@TVA.gov";

&REPLYTO = "";

&SENDER = "PY_Dept";

&MAIL_SUBJECT = "This is the subject";

&MAIL_TEXT = "This is the text in the email";

&MAIL_FILES = "C:\test.txt";

&MAIL_TITLES = "Test.txt";
&MAIL_SEP = ";";

&CONTTYPE = "";

&RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT,


&MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &CONTTYPE, &REPLYTO,
&SENDER);

If &RET <> 0 Then

Warning ("Email could not be sent!");

End-If;

2. Re: Sending a file as an attachment via email

user10634418
Newbie

user10634418 Jul 15, 2011 2:37 PM (in response to Michel)

&MAIL_FILES = "C:\test.txt";

The test.txt file referenced above will reside on the client or server?

If Server how do we move the file from local client to server via peopleCode?

Like
Show 0 Likes
(0)
Actions

3. Re: Sending a file as an attachment via email

Michel
Specialist

Michel Jul 18, 2011 3:12 AM (in response to user10634418)

It will reside on the server. You'll have to combine the code from the link you've
provided with the mail functionality.
Once the file is uploaded to the database you'll be able to use this file as an
attachment for the mail.
It should be possible to reference a file attached to the mail in the same way as
the link explains to display it on the page.

You might also like