Text format problem when sending mails
Hi all,
I am using the FM SO_DOCUMENT_SEND_API1 to send mail in text format, but the problem now is iam getting the space between each characters and also for each lines the alignment differs. can any one tel me how to solve this issue ?
D o c u m e n t N o L o g D e s c r i p t i o n
4 5 0 0 0 0 1 4 1 0 PO d o n e f o r G o o d s r e c e i p t o f P O 4 5 0 0 0 0 1 4 1 0
4 5 0 0 0 0 1 4 1 1 PO d o n e f o r G o o d s r e c e i p t o f I n t e r C o P O 4 5 0 0 0 0 1 4 1 1
4 5 0 0 0 0 1 4 1 2 PO d o n e f o r G o o d s r e c e i p t o f I n t e r C o P O 4 5 0 0 0 0 1 4 1 2 .
Thanks.
Hi Siva,
Seems problem with the types.Define following paramaters as shown below.
DATA: DOCDATA LIKE SODOCCHGI1 OCCURS 0,
OBJPACK LIKE SOPCKLSTI1 OCCURS 0,
OBJHEAD LIKE SOLISTI1 OCCURS 0,
L_OBJTXT1 TYPE SOLISTI1,
RECLIST TYPE SOMLRECI1,
DOC_CHNG TYPE SODOCCHGI1,
OBJPACK TYPE SOPCKLSTI1.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST = L_OBJPACK
OBJECT_HEADER = L_OBJHEAD
CONTENTS_BIN =
CONTENTS_TXT = L_OBJTXT
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = L_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 SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Ravinder
Similar Messages
-
Textarea problem when sending mail (only Firefox)
When sending mail using textarea item with multiple lines, carriage returns are taken away in resulting mail when sent in Firefox, but not in IE.
To send mail, I call Javascript function that gets textarea value ($v or $x.innerHTML give the same result) and calls then on-demand process that calls in turn APEX_MAIL function.
IgorThank you, Jari!
"pre" did the trick. Line breaks are OK now.
There is one small inconvenience, though: font becomes Courrier instead of sans-serif type. But this is less disturbing than missing line breaks.
Igor -
Problem when sending mails with excel attached
Hi
I'm tryin to send mails via SAPOffice with attached excel documents. I'm using FM SO_NEW_DOCUMENT_ATT_SEND_API1. I have a problem with the code. Here I post it:
DATA: ti_objbin LIKE solisti1 OCCURS 150 WITH HEADER LINE,
ti_objhex LIKE solix OCCURS 150 WITH HEADER LINE.
DATA: BEGIN OF i_excel,
sobid(8) TYPE c,
tab1 TYPE X VALUE 09, "tab code
name(80) TYPE c,
tab2 TYPE X VALUE 09, "tab code
city(40) TYPE c,
tab3 TYPE X VALUE 09, "tab code
kostl(10) TYPE c,
tab4 TYPE X VALUE 09, "tab code
ktext(20) TYPE c,
tab5 TYPE X VALUE 09, "tab code
fasig(10) TYPE c,
tab6 TYPE X VALUE 09, "tab code
ruta(255) TYPE c,
fin TYPE X VALUE 13, "carriage return
END OF i_excel.
i_excel-sobid = wa_datos-sobid.
i_excel-name = wa_datos-name.
i_excel-city = wa_datos-city.
i_excel-kostl = wa_datos-kostl.
i_excel-ktext = wa_datos-ktext.
i_excel-fasig = wa_datos-fasig.
i_excel-ruta = wa_datos-ruta.
WRITE i_excel TO ti_objbin-line.
APPEND ti_objbin.
CLEAR ti_objbin.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
TABLES
packing_list = ti_objpack
object_header = ti_objhead
contents_bin = ti_objbin
contents_txt = ti_objtxt
* contents_hex = ti_objhex
receivers = ti_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.
I have used this code before, in 4.6C release and it works fine, but now I'm on ECC5.0 and when i check the code, the next error message is generated: ""I_EXCEL" cannot be converted to a character-type field." If i try using MOVE i_excel TO i_objbin-line instead of WRITE, the error message changes to: ""TI_OBJBIN-LINE" and "I_EXCEL" are not mutually convertible in a Unicode program. program.". I have tried using ti_objhex table instead of ti_objbin in order to use 'context_hex' parameter (instead of 'context_bin') on FM, but i get the same result.
I've been searching any other FM to do this, and i've found more FM of SOI1 function group but i didn´t get the expected result. So i need to send the message with the excel attached, using this FM or any other, but I need some help. Anyone can help me?
Thanks and Regardshi this is a simple example to send the excel sheet as a mail
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver .
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
data: ld_store(50) type c. "Leading zeros
CONSTANTS: con_cret(5) TYPE c VALUE '0D', "OK for non Unicode
con_tab(5) TYPE c VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR' INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
*Modification to retain leading zeros
inserts code for excell REPLACE command into ld_store
=REPLACE("00100",1,5,"00100")
concatenate '=REPLACE("' wa_charekpo-ebelp '",1,5,"'
wa_charekpo-ebelp '")' into ld_store .
concatenate ld_store into .xls file instead of actual value(ebelp)
CONCATENATE wa_charekpo-ebeln ld_store wa_charekpo-aedat wa_charekpo-matnr INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
regards,
venkat. -
HTML Tag problem when sending mails through APEX
Hi,
My code for sending mail is below:
DECLARE
l_body CLOB;
l_body_html CLOB;
cursor c2 is
SELECT pn,pdt_name FROM lib_details WHERE a_date BETWEEN to_date(:P13_SDATE,'DD-MON_YYYY') AND to_date(:P13_EDATE,'DD-MON-YYYY');
BEGIN
for c_lib in c2
loop
l_body_html:=l_body_html ||
'<html><body>
ul>
li>'||c_lib.pn||' , '||c_lib.pdt_name||' /li>
/ul>'; p;
l_body_html:=l_body_html ||'</body></html>';
apex_mail.send(
p_to => 'xxxx',
p_from => 'xxxx',
p_body => l_body_html,
p_subj => 'Test Mail');
END;
Gives me the output in the format below:
all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
I am not able to figure this out. Can someone help?
OUTPUT
<html><body>
ul> li>a,b
/ul><html><body>
ul> li>c,d
/ul><html><body>
PLEASE NOTE: I have intentionally removed the starting tags (<) of ul and li so that the post will not be formatted.
Edited by: Suzi on Feb 9, 2012 1:18 PM>
Gives me the output in the format below:
all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
I am not able to figure this out. Can someone help?For HTML output you need to send it using the <tt>p_body_html</tt> parameter, not <tt>p_body</tt>.
PLEASE NOTE: I have intentionally removed the starting tags (<) of ul and li so that the post will not be formatted.Posting code wrapped in <tt>\...\</tt> tags eliminates the need to resort to these bizarre circumlocutions. -
Text formatting problems when exporting to Epub
During my fixed layout export to epub, some of the text on my pages is messed up (see image). Anyone know how to fix this?
FWIW: 1) I export with spreads disabled to keep the layout as i have it in ID. 2) I am using 3-4 fonts from typekit.yes, you are correct about what i am trying to accomplish. I will take your advice for testing the iBooks. that said, I'm trying to get the kindle version to work correctly. I don't know much about the process of preparing for Kindle and the documentation I've seen isn't much help to me (I'm not that technical). Any guidance for how i might resolve the issue described above? It's reallly unfortunate I can't just design in ID and then publish everywhere with the click of a button.
Thanks in advance for any help! -
How to send mails in HTML format from the send mail step of workflow?
Hi,
I have a requirement where I need to send mails in the html format from the send mail step of the workflows.
But what I found out that the html tags are not renderd and as such the output is in plain text.
I know that there is an alternative of using an activity step and use my own custom code from within there,But due to certain business constraints, I need to use the send mail step only.
My SCOT settings are all right.
Please let me know how it can be done.
Thanks,
Samrat.Samrat,
It can't be done, you have to use your own activity step.
What are these constraints that refrain you from doing that?
Rgds,
Patrick -
Problem: Cannot send mail unless Password is transmitted insecurely & Port is set to 587.. Can receive mail but can't send Code 501..
Need help with T-bird.. My OS is Win XP-64..Have been using Mozilla for about 10 years with little or no problems.. This happened when I upgraded to 3.17.. Spent hours on T-Bird diagnostics web site.. Called Comcast & talked to a net tech.. he ran some tests on his end & had me log into my Comcast e-mail account & all worked well,, so he concluded the problem was in T-Bird.. He had me change my port to 587 & disable connection security & authentication to none & I was able to send mail.. That was all he could do.. Comcast was working.. the problem is in T-Bird.. Can any one help with this problem.. I don't want to send mail with my password transmitted insecurely..
Thanks
RichardIt was not intended to be "snide". You said two separate things that at face value would be out of the ordinary.
I considered if it might be a typo for 31.7. Since 31.5 is the current formal release, I would have to thank you for volunteering to test a pre-release beta version. If it was truly 3.1.7 then it would appear that you have chosen, or have become stuck with a somewhat ancient version. In either case it's harder to reach out to you with any meaningful comments or advice. However I do watch various other sites and newsgroups and I don't see a clamour of distressed users, so it seems fair to suppose that this feature isn't actually broken in 31.7.
And you said XP 64. XP is obsolete and no longer supported and if there is a 64-bit version, then again you have set yourself apart from the mainstream.
I had a look at the comcast site and found some puzzling recommendations. Some users come here asking how to set up a secured connection in Thunderbird when it isn't offered by the server. Comcast are different, in that they mention the ports 143 and 587, and also 993 and 465. So far so good, in that security is actually on offer, but they also suggest that you enable SSL, regardless of which port is being used. It would be unusual and unconventional to offer TLS or SSL on ports 143 and 587. STARTTLS would be more credible on these ports.
Have you tried IMAP on 993 and SMTP on 465? SMTP on 587 with SSL, or TLS, is not impossible, but is improbable. -
Problem in sending mail from VF03
Hi
I am just getting a problem in sending mail to the recipient from script.
please find the below code and let me know why there is no data in otf_tab table.
DATA: otf_tab TYPE TABLE OF itcoo WITH HEADER LINE.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = i_itcpp
TABLES
otfdata = otf_tab
EXCEPTIONS
OTHERS = 1.
IF otf_tab[] IS NOT INITIAL.
TRY.
CREATE OBJECT mailer
EXPORTING
i_nast = nast.
mailer->get_mail_address( EXPORTING i_adrnr = vbdkr-adrnr ).
mailer->get_mail_address( EXPORTING i_adrnr = vbdkr-adrnr
i_vkorg = vbdkr-vkorg
i_vtweg = vbdkr-vtweg ).
zcl_sd_mail_output=>convert_otf_to_pdf( IMPORTING pdf_xstring =
gv_pdf_string
CHANGING otf_table =
otf_tab[] ).
mailer->build_and_send_email( EXPORTING pdf_xstring =
gv_pdf_string ).
CATCH zcx_sd_mail_no_mailid INTO error.
error_txt = error->get_text( ).
zcl_sd_mail_output=>protocol_update( msg_id = 'VN'
msg_nr = '902'
msg_ty = 'E'
msg_v1 = error_txt ).
retcode = 1.
CLEAR error_txt.
ENDTRY.
ENDIF.
Since my OTf_tab is initial i am unable to send mails.Hi,
If the OTF Data table is blank then you might have missed the parameter "GETOTFDATA" at the time of calling "OPEN_FORM". Please pass field TDGETOTF = "X" in paramter "OPTIONS" when you are calling "OPEN_FORM".
You can also visit this link for more information.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556?QuickLink=index&overridelayout=true
Cheers, -
Hi all,
I'm having some problem in sending mail. I did all configuration regarding this. After that when i tried to send mail, its giving some error, tht is, "SendMailService is not available".
Can anybody help me on this.
Thanks,
RajHi Raj,
Go to System Administrator > System Configuration > Knowledge Management > Content Management > Global Services > Mailing Service and make active option true, then restart your portal. Hope it'll work fine.
Regards,
Ganpati Jha -
Problem in sending mail through dynamics actions
Hi Friends,
I have a problem in sending mail through dynamics actions . In this we pass a subroutine in dynamics actions which send an mail when promotion action occured.
Problem is that sometimes it will send an mail or sometimes not. I have no idea to solve this problem.
Can anyone suggest me .
Thanks ,
Anish
Moderator message : Duplicate post locked.
Edited by: Vinod Kumar on Sep 5, 2011 9:45 AMHi,
Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
thank You -
PROBLEM IN SENDING MAIL TO POSITIONS THROUGH SEND MAIL STEP
Hi Experts,
I am facing some problems in sending mail to positions from the organization structure from the send mail step.When I am using user as the recipient type it is working fine...but when i am choosing S position as the recipient type it is giving the error in the workflow log stating that method SENDTASKDESCRIPTION cannot be executed.
I need to find a solution urgently...any suggestion would be sincerely appreciated.
thanks.
NarsinghWell you have probably tried this.. but just a recheck.
1 . send email setep select Organizational Object
2. Recipient Type Organizational Unit
3. Here do an F4 and then select the Unit...
Try this SAP behaves weirdly at times...
after this do Refresh Buffers.. and Org Unit...
Let us know if this works -
"smtp error" in webmail when sending mails
Hello,
"smtp error" in webmail when sending mails
why?With the very little data offered, I can only give a general idea.
"smtp error" usually means that webmail isn't pointed to a smtp server for sending out mails.
Webmail normally (by default) points to the same box it's on for sending mails out. You can change the host and port with configutil.
Some versions of webmail must point to iMS, and other mail servers won't work. Since I have no idea what version you have, I can't tell if this is a problem.
Did it ever work?
What version are you using? -
Dtmail on x86 crashes when sending mail
Hi,
I'm running Solaris 10 on x86 and I'm wondering if there is a fix or a workaround
for dtmail crashing when sending mail. There is an existing bug report for this
filed July 20 2006 (6346618) but I'm unable to view the bug detail since I have
not yet fully decided on a service plan. I've searched around Sunsolve and
google but nothing is coming up. I tried build 45 of Solaris Express and the
same problem is present. Does anyone have any additional information
about this? Is a fix available for serivce plan holders?
Thanks,
PatThank you for looking at the bug. I do have 121488-01 installed; patch dated 12/19/2005. If a fix for this is rolled up into another patch, so far it is not available to me. As of this morning, there are no updates; dtmail still crashes on sending mail.
Searching sunsolve for this returns three bug numbers:
6346618 (dated July 20, 2006)
5091421 (dated November 4, 2005)
1187150 (dated November 16, 1995)
although the 1995 bug is probably unrelated. Looks like my best chance at working around this may be to grab the dtmail binary from Solaris 9. Thanks to all who have looked at this with me so far; I appreciate it.
Regards
Pat -
Java.lang.NumberFormatException when sending mails
Gurus,
I am using java mail 1.4 to send mails from my application and the code to do so is
public void postMail(String recipient, String message) {
logger.fine("in postMail method..");
boolean debug = true;
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", ConfigProperty.getProperty("mail.smtp.host"));
props.put("mail.smtp.auth","true");
props.put("mail.smtp.port", ConfigProperty.getProperty("mail.smtp.port"));
props.put("mail.smtp.from", ConfigProperty.getProperty("mail.from"));
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
Message msg = new MimeMessage(session);
try {
String from = ConfigProperty.getProperty("mail.from").trim();
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress addressTo = new InternetAddress(recipient);
msg.addRecipient(Message.RecipientType.TO, addressTo);
msg.setSubject(ConfigProperty.getProperty("mail.subject"));
msg.setContent(message, "text/plain");
logger.info("Sending mail now...............................");
Transport trans = session.getTransport("smtp");
trans.connect("casarray.arg.ae",username,password);
trans.send(msg);
} catch (Exception e) {
e.printStackTrace();
}However i am getting the strange error when sending mails. My email is is very simple [email protected]
Please help me understand the issue here
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:499)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)
at com.roadMiles.view.unsecure.page.bean.LoginPageBean.forgotPassword(LoginPageBean.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:788)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:306)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)The error message is telling you exactly what's wrong:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:499)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)At line 54 of EmailNotification.java (which I assume is your class), you're calling connect(), but that fails, because, deeper down, it's trying to parse the empty String ("") as a number. So don't pass the empty String to connect(); pass a valid number instead. -
Problem of sending mail with MTA
Hi,
I have installed Sun Messaging Server, but I have a problem to send mail to other SMTP server over internet, like gmail, hotmail... So I have tried to send an email using javamail and I get this exception "530 5.7.1 Relaying not allowed", that mean that I don't have a Relay SMTP to routing the messages. But the idea that I have, is that the MTA installed with Messaging Server play the role of SMTP Relay.
So this idea is true, so I think is can be I problem of configuration, and I need to have may own SMTP Relay and don't using ISP Relay.
and I thank you for your help,
Mabrouk.GS1-Tunisia wrote:
21-Nov-2008 17:32:31.58 tcp_local Q 1 [email protected] rfc822;[email protected] [email protected] TCP active open: Failed connect() Error: Connection timed out
This indicates that Messaging Server is unable to connect to the yahoo mail servers.
I have configured my server to use mydomain.com with ip 41.x.x.xHow did you configure your server to achieve this -- what settings did you add/change?
but when I see this log [email protected] is converted to [email protected] and 192.168.3.2 is mailhost which is behind firewall in DMZ, So it may be the problem of NAT, I don't know!!!
Given that Messaging Server cannot connect to the yahoo mail servers, the problem appears to be at the networking level so the firewall is most likely blocking the outgoing port 25 connection.
When you are on the Messaging Server system, what output do you get for the following command:
telnet a.mx.mail.yahoo.com. 25Regards,
Shane.
Maybe you are looking for
-
Error While Deploying ADF BC JSF Application on Oracle WebLogic Server 10.3
Hi All, I am Deploying ADF BC JSF Application on Oracle WebLogic Server 10.3 My JDeveloper Version is - JDeveloper10.1.3.0.4 I followed Following Links for Deployment http://download.oracle.com/otn_hosted_doc/jdeveloper/11/demos/wls/wls.html http://b
-
Time machine did not back up photos
When I was preparing to upgrade from Mountain Lion to Mavericks, I heeded advice and purchased an external drive and backed up my iMac with Time Machine. I was very glad I did, because I encountered the 'There is a problem with your hard disc' messa
-
How to reduce execution time ?
Hi friends... I have created a report to display vendor opening balances, total debit ,total credit , total balance & closing balance for the given date range. it is working fine .But it takes more time to execute . How can I reduce execution time ?
-
"Where is the File?" Window
When you open an existing Premiere CS4 project and it fails to find a file, a "where is the File?" dialogue box opens. This contains a very useful check box "Display only exact Name Matches". This worked perfectly with CS4.1, but, for me, it no long
-
Setting the fg/bg color of a 1 bit image
Is there a simple way to set the foreground and background colors of a one bit image? What I need to do is draw a bitmap on a Canvas component where all black pixels in the loaded (gif) Image paint as my custom foreground color and all white pixels p