Problem in sending Email attachment
Hi all,
I am new to Oracle apex. I want to send email in apex with attchment. i have a send email button on clicking of which the following process will be called
DECLARE
l_id number;
fileName varchar2(50);
v_item blob;
BEGIN
apex_mail.send(
p_to => Receiver email id ,
p_from => Sender email id,
p_subj => 'My Subject',
p_body => 'Test Body',
apex_mail.push_queue();
END;
right now i am able to send email but now dont know how to use -- APEX_MAIL.ADD_ATTACHMENT to send reports as attachments
Here are some queries related to the parameters in APEX_MAIL.ADD_ATTACHMENT:-
1) what to send in parameter ' p_attachment '
2) what to send in parameter ' p_filename'
3)what to send in parameter ' p_mime_type '
my requirement is to send the report displayed in the page to be send as attachment with this email. I am quite confused about these parametersto be sent in APEX_MAIL.ADD_ATTACHMENT.
please provide an example if possible.
Thanks in Advance
Anu
Edited by: user12259335 on Mar 12, 2010 11:55 PM
Edited by: user12259335 on Mar 13, 2010 1:08 AM
Hi,
You need save your report to CLOB if you like send it using APEX_MAIL.ADD_ATTACHMENT.
You can do that e.g. with xml_spreadsheet
http://matzberger.de/oracle/spreadsheet-tut-en.html
Something like this then
DECLARE
l_cursor NUMBER := dbms_sql.open_cursor;
v_clob CLOB;
l_id NUMBER;
BEGIN
l_id := APEX_MAIL.SEND(
p_to => '[email protected]',
p_from => '[email protected]',
p_subj => 'APEX_MAIL with attachment',
p_body => 'Please review the attachment.',
p_body_html => '<b>Please</b> review the attachment'
dbms_sql.parse(
l_cursor ,
'SELECT * FROM emp',
dbms_sql.native );
xml_spreadsheet.abfrage(
p_cursor => l_cursor ,
p_file => v_clob ,
p_sheetname => 'emp_report'
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => v_clob,
p_filename => 'emp_report.xml',
p_mime_type => 'text/xml'
APEX_MAIL.PUSH_QUEUE;
COMMIT;
END;I did not test that code, but it should work.
This is just one way to do it.
Br,Jari
Similar Messages
-
Web jetadmin digital sending - email attachment settings
One of the settings in Web JetAdmin under DIGITAL SENDING is DIGITAL SENDING - EMAIL ATTACHMENT SETTINGS and the options are SMALL, STANDARD and LARGE.
What do these options do? What are small, standard and large? Are they detailed om Mb etc?
ThanksThis seems to be a commercial product. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
You can find the Commercial board here:
http://h30499.www3.hp.com/t5/Print-Servers-Network-Storage/bd-p/bsc-254
Best of Luck!
You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too. -
Problem in Sending email from Reports Queue Manager
Hi
I am getting problem in sending email from reports queue manager.
It says that error in logging to mail server.
If any body knows the sol then pl help me out.
thanksHi
I am getting problem in sending email from reports queue manager.
It says that error in logging to mail server.
If any body knows the sol then pl help me out.
thanks -
Having problems in sending email..always saved in outbox and cannot send bcoz of server failed
The email server you are using to send mail through requires the password, if any is required it needs to be set in the location that I pointed out in the earlier post.
It is usually the same password you use for receiving emails.
I don't use either Facebook or Twitter so I am not sure how to help with those. -
Logic Required to send email attachment to particular dealer number ..
I have output data saved in internal table, which has many fields from diff tables.
I need this logic as how to build .... I need to send email attachment to particular dealer number and all his related details ... dealer shldnt get other dealer details ... so i m sorting final output table details by kunnr vbeln and fkdat.
how will i write code or logic which will upload data of particular dealer number in output table one by one and send across as emails ? What i mean is for every customer numbe, his details which can be multiple needs to be send across.
I tried doing this, but didnt get any good results.
sort finaltable by kunnr vbeln fkdat.
loop at Finaltable into workarea.
at new kunnr.
perform mail send function to each customer number
endiat
endloop
Plz advise.
Thnxhi,
you can check this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin[] = li_mess_att[].
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL -
I'm having problems receiving/sending emails thru Outlook.
I switched internet connection from AT&T to Comcast and I'm still utilized several AT&T email address's for free. I'm having problems receiving/sending emails thru Outlook. Could the problem be due to using their free emails with no support.
Do I have to go thru yahoo to read/send emails?Change the ISP would not effect the email connection generally. (Only when ISP disable your mailbox which they could control directly.)
I suppose that your Outlook still store/cache the AT&T messages, try to export them as PST data file for backup.
Setup the new Yahoo in your current Outlook first and then import that backup.pst to continue to use.
http://support.microsoft.com/kb/287070/en-us
Thanks
Tony Chen
TechNet Community Support -
Send Email Attaching the Report generated in Program.
Hi All,
I am generating a report in list format with write statements.
My requirement is to send an email attaching this report as an attachment.
I wanted to know how to get the listobject of the report generated by my program from the memory. Can anyone guide me with this ?
It will be appreciable , If any one can give me more information on sending mails attaching the reports generated by the program.
Thanks in advance,
MayankHi,
I think the problem is not clear.
My problem is to get the listobject name which got generated after the program run.I want to attach this list report to the email. I have seen a code from one of the link.
Here it is.
List of Users According to Logon Date and Password Change
NOTE: Create ALI/OTF Document in Spool
SUBMIT rsusr200 WITH valid = 'X'
WITH notvalid = space
WITH unlocked = 'X'
WITH locked = space
EXPORTING LIST TO MEMORY AND RETURN.
<b>* Read list from memory into table
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.</b>
Because listobject is of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = lt_listobject
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
Here the report is sumitted with the option of exporting the list in to the memory which is later read using 'LIST_FROM_MEMORY'.
But here i need the same report's output to be captured and want to read the list generated from memory into table.
How can i get the listobject of the list generated by the report in the same report program itself ??
Please let me know.
Mayank -
Problem in sending pdf attachment
hi all
i am facing a problem when i am sending a pdf attachment in mail... It is showing an errror that the file is not decode properly as it is an email attachment. The below code works fine for other file types. please help meFUNCTION ZMAIL_READ.
*"*"Local Interface:
*" IMPORTING
*" VALUE(SUBJECT) TYPE SO_OBJ_DES
*" VALUE(TEXT) TYPE STRING
*" VALUE(SENDER) TYPE ADR6-SMTP_ADDR
*" VALUE(RECEIVER) TYPE ADR6-SMTP_ADDR
*" VALUE(ATTACHMENTS) TYPE Z_T_XATTACH OPTIONAL
*" EXPORTING
*" VALUE(MESSAGE) TYPE STRING
DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_bcs_send_request TYPE REF TO cl_bcs,
l_send type ADR6-SMTP_ADDR ,
l_rec type ADR6-SMTP_ADDR .
data: it_text type table of soli,
wa_text type soli.
DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
DATA: lv_recipient_uid TYPE uname,
lv_recipient_mail TYPE adr6-smtp_addr.
data: lo_message type ref to cx_send_req_bcs value is initial,
text_val type string.
data: it_userlist type table of BAPIUSNAME,
wa_userlist type BAPIUSNAME.
data: it_selection_range type table of BAPIUSSRGE,
wa_selection_range type BAPIUSSRGE.
data: wa_attachment TYPE zxattach,
attachment_sub type SO_OBJ_DES.
DATA: xstr type xstring,
str TYPE string,
str1 type string,
it_str2 type table of soli,
wa_STR2 TYPE SOLI,
DATA: LOC_CONV TYPE REF TO CL_ABAP_CONV_IN_CE,
wa_soli type soli,
it_soli type table of soli,
it1_solix type solix_tab.
data result TYPE boolean.
data: i_ext(10) type c,
i_type type soodk-objtp.
wa_text-line = text.
append wa_text to it_text.
CLASS cl_bcs DEFINITION LOAD.
try.
lo_send_request = cl_bcs=>create_persistent( ).
catch cx_send_req_bcs.
endtry.
* Message body and subject
data: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
try.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = it_text
i_subject = subject ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
endtry.
loop at attachments into wa_attachment.
attachment_sub = wa_attachment-file_name.
it_str2 = wa_attachment-attach.
loop at it_str2 into wa_str2.
str1 = wa_str2-line.
try.
CALL FUNCTION 'SSFC_BASE64_DECODE'
EXPORTING
B64DATA = str1
* B64LENG =
* B_CHECK =
IMPORTING
BINDATA = xstr.
catch cx_sy_dyn_call_illegal_type.
endtry.
try.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = xstr
APPEND_TO_TABLE = 'X'
* IMPORTING
* OUTPUT_LENGTH =
TABLES
BINARY_TAB = it1_solix
catch cx_sy_dyn_call_illegal_type.
endtry.
endloop.
try.
CALL FUNCTION 'SA_KW_RFC_FILENAME_EXT_GET'
EXPORTING
AREA = 'IWBSOLAR'
MIMETYPE = wa_attachment-type
IMPORTING
EXTENSION = i_ext
catch cx_sy_dyn_call_illegal_type.
endtry.
i_type = i_ext.
try.
lo_document->add_attachment(
EXPORTING
i_attachment_type = i_type
i_attachment_subject = attachment_sub
i_att_content_hex = it1_solix ).
CATCH cx_document_bcs.
endtry.
endloop.
try.
lo_send_request->set_document( lo_document ).
CATCH cx_send_req_bcs.
endtry.
wa_selection_range-PARAMETER = 'address'.
wa_selection_range-field = 'e_mail'.
wa_selection_range-sign = 'I'.
wa_selection_range-option = 'EQ'.
wa_selection_range-low = receiver.
append wa_selection_range to it_selection_range.
try.
CALL FUNCTION 'BAPI_USER_GETLIST'
* EXPORTING
* MAX_ROWS = 0
* WITH_USERNAME = ' '
* IMPORTING
* ROWS =
TABLES
SELECTION_RANGE = it_selection_range
USERLIST = it_userlist.
catch cx_sy_dyn_call_illegal_type.
endtry.
read table it_userlist into wa_userlist index 1.
try.
lo_sender = cl_cam_address_bcs=>create_internet_address( sender ).
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
return.
endtry.
try.
lo_recipient = cl_sapuser_bcs=>create( wa_userlist-USERNAME ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient ).
* i_express = 'X' ).
catch cx_send_req_bcs.
catch cx_document_bcs.
catch cx_address_bcs.
endtry.
try.
** Send email
LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
lo_send_request->send( EXPORTING
i_with_error_screen = ' '
RECEIVING
result = result ).
COMMIT WORK.
CATCH CX_DOCUMENT_BCS.
CATCH CX_SEND_REQ_BCS INTO lo_message.
CATCH CX_ADDRESS_BCS.
text_val = lo_message->IF_MESSAGE~GET_TEXT( ).
endtry.
if result = 'X'.
message = 'E-Mail sent'.
else.
message = 'E-Mail not sent'.
endif.
ENDFUNCTION. -
Hi!
I'm new at apex and so far this forum was very helpful. But now I can't find a solution to my problem. So here it goes.
I have a standard report with a checkbox which stores user's id. Now I want to send email to all users who has been checked
with certain data for those users. This is working perfectly. The problem is the attachment file. Client wants that the attachment
file contains data which are meant only for him. For example. I'm sending mail to userA, UserC and userG. The attachment file
for userA must contain data about userA, the attachment file for userc must contain data about userC... The idea is that I make a
report with BI Publisher and use this report as attachment. This is working fine, but in the report query for this template I
don't know how to reference only checked values and how to know in the process of sending email which user is being processed
so I can reference this user in report query. The problem is that the report query is made independently from process of sending email.
Is there a way perhaps making a report query for template dynamically?
Process of sending email looks something like this:
for i in 1..apex_application.g_f01.count
loop
select email into posta from upor where user_st=apex_application.g_f01(i);
datoteka:=apex_util.get_print_document(
p_application_id=>'101',
p_report_query_name=>'priloga',
p_report_layout_name=>'priloga',
p_report_layout_type=>'rtf',
p_document_format=>'rtf');
st_poste:=apex_mail.send(
p_to=>posta,
p_from=>[email protected],
p_body=>mess,
p_subj=>'Subject');
apex_mail.add_attachment(
p_mail_id=>st_poste,
p_attachment=>datoteka,
p_filename=>'priloga.rtf',
p_mime_type=>'application/rtf');
end loop;
If you have a different solution how to solve this, I'm open to ideas.
ThanksWhat I would suggest is doing this in pieces.. You need to build a report based upon certain data elements for a user, correct? get your report working for this case, then look at this article on how to build reports to be saved as blob in your schema : http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt3_otn.htm.
After that you can look at building a batch job to do the following:
run your reports to build blob columns in a table, along with associated e-mail address
loop through the table and send e-mails from each row's data
thank you,
Tony Miller
Webster, TX -
Problem with sending email .
Hi,
I am using SO_NEW_DOCUMENT_ATT_SEND_API1 fm to send email with one excel attachment. But while sending the mail the body of the mail is converted into one PDF file and it is attached along with the excel attachment. so i am getting two attachment and the body of mail is blank. my requirement is to send attachment along with the body of message.
I have checked in the outbox , the mail is sent in the required format with one excel attachment and body of mail. but while receiving the mail body is comming as a pdf attachment. is there any configuration problem. pl help me to solve the problem.
Regards.
Biswaeven look at SOST Status and Try to set up sap inbox and send email to your sap inbox.
if you get same problem and should be configurational issue or techinical issue.
Reward Points if it is helpful
Thanks
Seshu -
Send email attachment inline - OSB
Hello,
I am sending an email with an xml attachment to another system. The target system expects the email attachment to be in 'inline'. Here is my configuration for this.
<con:attachment xmlns:con="http://www.bea.com/wli/sb/context">
<con:Content-Type>text/xml</con:Content-Type>
<con:Content-Transfer-Encoding>7bit</con:Content-Transfer-Encoding>
<con:Content-Disposition>inline; filename=”MyXML”</con:Content-Disposition>
<con:body>{$attachmentXML}</con:body> <!-- dynamically populated -->
<con:body>
My problem is when the email reaches the target, the attachment is not displayed 'inline'. My understanding is with the above configuration 'Content-Disposition' as 'inline', the attachment should be displayed inside 'body' (without the 'paper clipping' image)
Please note: If I use a java class to publish with the above content disposition, the attachment is displayed 'inline'. So I am not worried about the target SMTP server and the target system.
Any help will be appreciated.
With Regards,
RanjithDid you select Outbound Request in Transport Header??
Please refer below sample code.
<con2:route xmlns:con2="http://www.bea.com/wli/sb/stages/publish/config">
<con1:id>_ActionId-5670259997675832921-54115704.1426f7f029e.-7c5b</con1:id>
<con2:service ref="ActiveITRoster/BusinessService/BS_MailService" xsi:type="ref:BusinessServiceRef" xmlns:ref="http://www.bea.com/wli/sb/reference"/>
<con2:outboundTransform>
<con4:transport-headers copy-all="false" xmlns:con4="http://www.bea.com/wli/sb/stages/transform/config">
<con1:id>_ActionId-5670259997675832921-54115704.1426f7f029e.-7c5a</con1:id>
<con4:header-set>outbound-request</con4:header-set>
<con4:header name="Content-Type" value="expression">
<con1:xqueryText>'text/html'</con1:xqueryText>
</con4:header>
<con4:header name="Subject" value="expression">
<con1:xqueryText>$emailSubject</con1:xqueryText>
</con4:header>
<con4:header name="To" value="expression">
<con1:xqueryText>$mailids</con1:xqueryText>
</con4:header>
</con4:transport-headers>
</con2:outboundTransform>
</con2:route>
You will find ws, email, http, file, ftp and few other modes of transport when you add a header.
Please select Content-Type in ws & To,Subject (select them depending on your requirement) in email.
Without using transport header, how will you pass the information in the mail?
How will you set the email parameters? -
Flex & PHP - Send email attachment
I'ld like for my visitor to be able to send an email to a friend with the creation from my application as an attatchment (so like a screencap of the creation). I can get Flex and PHP to communicate and send an email, but I can't get the image to send. It sends an attachment that is 2o or less and can't be opened (of course !).
I don't get an error return from my application
I found these posts linked below which helped me, but I still don't get how to pass the image from Flex to PHP.
Saving entire Flash document as JPEG to email as an attachment
Sending an E-mail with attachment with PHP from Flex
Here is my code from Flex :
private function sendMail():void{
var _nomSTF:String = nomSTF.text;
var _emailSTF:String = emailSTF.text;
var _emailFriendSTF:String = emailFriendSTF.text;
var _sujetSTF:String = sujetSTF.text;
var _messageSTF:String = messageSTF.text;
//IMAGE
var fr:FileReference = new FileReference();
var encoder:PNGEncoder = new PNGEncoder();
var screenshotData:BitmapData = new BitmapData(conteneurDeMonImage.width, conteneurDeMonImage.height, true, 0xFFFFFF);
screenshotData.draw(conteneurDeMonImage);
//var outputData:ByteArray = encoder.encode(screenshotData);
//var base64:Base64Encoder = new Base64Encoder();
var png:PNGEncoder = new PNGEncoder();
byteArray = png.encode(screenshotData);
//base64.encodeBytes(outputData);
//FIN IMAGE
var evValidMail:ValidationResultEvent = emailSTFValidator.validate();
var evValidMailFriend:ValidationResultEvent = emailFriendSTFValidator.validate();
var evValidName:ValidationResultEvent = nomSTFValidator.validate();
if (evValidMail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidMailFriend.type == ValidationResultEvent.VALID){
emailService.send({senderName: _nomSTF, senderEmail:_emailSTF, emailFriendSTF: _emailFriendSTF,
emailSubject:_sujetSTF, emailMessage: _messageSTF, file : byteArray});
} else {
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName", "invalid");
private function emailResultSTF():void{
Alert.show("Votre message a bien été envoyé");
containerSendToFriend.visible = false;
<fx:Declarations>
<s:HTTPService id="emailService" url="src/mail.php" method="POST"
resultFormat="xml" useProxy="false"
result="emailResultSTF()"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail + '\n' + event.message.toString())"/>
</fx:Declarations>
And here's my PHP code :
$fileatt_type = "application/octet-stream";
$fileatt_name = "baignoireElyseeConcept.png";
$sender_name = $_POST['senderName'];
$email_from = $_POST['senderEmail'];
$email_subject = $_POST['emailSubject'];
$email_message = $_POST['emailMessage'];
$email_to = $_POST['emailFriendSTF'];
$headers = 'From:'.$sender_name.'<'.$email_from.'>';
$data= $_POST['file'];
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$mailsend = mail($email_to, $email_subject, $email_message, $headers);
Thanks for your helpI've looked around for an answer for this for days and finally got it to work so here's how I did it (helped by a lot of ressources on the internet and specifically this one : http://j-query.blogspot.com/2011/02/save-base64-encoded-canvas-image-to-png.html)
here's my Flex code for my image :
var je:JPEGEncoder = new JPEGEncoder(100);
var bd:BitmapData = new BitmapData(conteneurDeMonImage.width,conteneurDeMonImage.height);
bd.draw(conteneurDeMonImage);
var ba:ByteArray = je.encode(bd);
var be:Base64Encoder = new Base64Encoder();
be.encodeBytes(ba);
var encodedData:String = be.toString();
// Testing if my base64 is working in FLEX
/*var byteArr:ByteArray;
var B64dec:Base64Decoder = new Base64Decoder();
B64dec.decode(encodedData);
byteArr = B64dec.toByteArray();
imageEnGrand.load(byteArr);*/
emailService.send({senderName: _nomSTF, senderEmail:_emailSTF, emailFriendSTF: _emailFriendSTF, emailSubject:_sujetSTF, emailMessage: _messageSTF, file : encodedData});
Here's my PHP code :
$fileatt_type = "application/octet-stream";
$fileatt_name = "test.jpg";
$sender_name = $_POST['senderName'];
$email_from = $_POST['senderEmail'];
$email_subject = $_POST['emailSubject'];
$email_message = $_POST['emailMessage'];
$email_to = $_POST['emailFriendSTF'];
$headers = 'From:'.$sender_name.'<'.$email_from.'>';
$data = $_POST['file'];
$data = str_replace('data:image/png;base64,', '', $data);
$data = str_replace(' ', '+', $data);
$img_data = base64_decode($data);
$png = chunk_split(base64_encode(($img_data)));
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n"."Content-Type: multipart/mixed;\n"." boundary=\"{$mime_boundary}\"";
$email_message =
"This is a multi-part message in MIME format.\n\n".
"--{$mime_boundary}\n"."Content-Type:text/html; charset=\"utf-8\"\n".
"Content-Transfer-Encoding: 7bit\n\n".$email_message."\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$png . "\n\n" .
"--{$mime_boundary}--\n";
$mailsend = mail($email_to, $email_subject, $email_message, $headers);
I hope it helps someone who has the same problem as me ! -
Problem in sending email in SAP system
Hi Gurus - I'm trying to trigger email from the output type in ECC 6.0. Output has been successfully processed(Green), but the recipient is unable to receive email.
In Transaction code, SOST, the status of the message is showing as sent and in Transaction SCOT, the status of the messages is showing as "In transit". Can you please assist us to find the solution to the problem.
Thanks,
SreeDear Sreedhar,
Are you facing this problem while sending to all mail Ids ?
Please try to send common Ids like yahoo, gmail etc...Is there any attachment in your mails ?
Probably these problem is because of the Firewalls are blocking the mails .
In SOST it is green means from SAP has sent the mail and Exchange server has to do the rest .
Troubleshoot in that area by asking the Exchange Admin .
Regards,
Nibu -
Having problem to send email with POP account ...
Hi,
I didn't have that problem before upgrading to my new 3GS iPHone. I have 3 email accounts on my iPhone: POP (videotron.ca), GMail and MobileMe. They all work fine except my POP account.
From the POP account I can receive my email but I cannot send any. Funny enough, my emails are sent when the account is desactivated from my «Mail, contacts and Calendar» preferences on my iPhone.
Can somebody help me ? Regards.
RobertHi Robert,
I upgraded with the Iphone 3Gs a week ago and got the same problem with Videotron. The problem is with videotron as usual. If you want to be able to send email from your Iphone just go to Gmail, open an account FREE with them and then use this account to send Email...Work perfectly OK with me. Then of course you will have to phone videotron to make sure your account is fully available when you go on there Web site open the read email and be able to read your email if not solve the problem with them by phone. unless you will be able to send email easily with gmail and mather of fact it is free.
Hope this will help from Quebec to Quebec!!! -
Problem to send out attachment
Hi all,
This is urgent. Any advice is appreciated. I have java class to send out attachement. The program was working fine without any issues until last Friday. Suddenly, it could not send any attachment email out. I was able to send out a simple email without attachment. I did not know what changed. I ran out of resources for troubleshooting it.
Here is my code:
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SendAttachment {
public void Send (String MailHost, String AddFrom, String AddTo, String FileAttName)
throws Exception {
String host = MailHost;
String from = AddFrom;
String to = AddTo;
String fileAttachment = FileAttName;
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session =
Session.getInstance(props, null);
// Define message
Message message =
new MimeMessage(session);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject(
"Hello JavaMail Attachment");
// create the message part
BodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("Hi");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
my test program:
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
public class TestJavaMail {
public static void main(String[] args) {
String myhost =args[0];
String from =args[1];
String to = args[2];
String filename = args[3];
try {
System.out.println("Start .....");
System.out.println("Preparing...");
SendAttachment app = new SendAttachment();
app.Send(myhost, from, to, filename);
System.out.println("Success!");
} catch (Exception e) {
//System.err.println(ExceptionUtil.printStackTrace(e));
System.exit(-1);
After successful compilation, here is how I ran the class:
java TestJavaMail mymaihost.com [email protected] [email protected] /tmp/test.txt
It stops just before it calls Transport.send( message );
Any ideas are greatly appreciated.Hello,
This could help you.
http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010
if the reply help you mark it as your answer.
Free Managed .NET
Word Component(Create, Modify, Convert & Print)
Maybe you are looking for
-
Hi, I've just installed mavericks but my HPc4180 will not print and is showing a 'blank' page in previews can anyone help me?
-
Add a new button to BID Invitation screen
Hi, How to Add a new button to Bid Invitation Screen in SRM? Thanks, Raveendra
-
How do you view original CRM billing document from R3
We have sales orders and billing now in CRM. We have a requirement to link the accounting document to the billing document in CRM. Does anyone know if there is a standard function module to get the document flow or link to the CRM document?
-
I have a linkbutton created in actionscript, with text inputted into the box. I cannot get the width of the box. How can i get the width of a linkbutton created dynamically
-
Failure Does Not Proceed to Review
This has to be simple. I have not had the problem before. In Cap 5.5, I have one-question quiz, a T/F question. When answered correctly, the quiz results page opens. When failed, nothing happens; quiz question just sits there. I want to display resu