Leading Spaces in CSV file while sending Email
Hi All,
Iam sending CSV file via email, Iam getting leading space for the first field from column second.
I have used the below code for appending internal table.
Concatenating all the fileds with comma separator and aded 'cl_abap_char_utilities=>newline' at the last.
For first column iam getting correctly, form second column onwards iam getting spaces in front of first field. I have used the FM, SO_NEW_DOCUMENT_ATT_SEND_API1 for sending the email. Please suggest. thanks.
Hi,
Concatenate cl_abap_char_utilities=>cr_lf before every line/record of the file.
This should resolve the issue.
Thanks,
Anupam
Similar Messages
-
Create a csv file and send it in an email
In coldfusion, is it possible to create a csv file and send it in an email, without ever saving that file on the hard drive?
Yes, you can create an email attachment without writing a file to disk. This feature was introduced in CF 8.0.1.
I've posted a sample to a previous thread on the forums.
http://forums.adobe.com/message/2123297
See the CFMAILPARAM section of CF 8.0.1 release notes for attachments without a file on disk.
http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf -
How to set attched file name while sending email through ABAP
Hi All- tell me how to set attched file name while sending email through ABAP.
regards...
AbhaySure, when you are adding your entry to the packing list, give the name in the obj_name field.
*File 2
mailbin = 'This is file 2'.
append mailbin.
data: start type i.
data: end type i.
start = tab_lines + 1.
describe table mailbin lines end.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = start.
mailpack-body_num = end.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST2'. "<- RIGHT HERE
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
Regards,
RIch Heilman -
Error while sending email to external mail - Urgent
Hi All,
I am getting error while sending email with attachement. The Error code is 02.
I am not able to identify the error. bold Please help me in solving this problem.
Is it anything wrong with the code or Any Configuration with SCOT/SOST.bold
the code i am using is :
REPORT YVR_F MESSAGE-ID XX .
TABLES : EDIDC, EDIDS, EDPAR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_STATUS LIKE EDIDC-STATUS DEFAULT '51'.
SELECT-OPTIONS : S_DIRECT FOR EDIDC-DIRECT,
S_MESTYP FOR EDIDC-MESTYP,
S_CREDAT FOR EDIDC-CREDAT.
SELECTION-SCREEN END OF BLOCK B1 .
PARAMETER: P_EMAIL LIKE SOMLRECI1-RECEIVER,
P_SENDER LIKE SOMLRECI1-RECEIVER no-display,
P_DELSPL AS CHECKBOX,
P_ONLINE NO-DISPLAY.
DATA : TB_EDIDC LIKE STANDARD TABLE OF EDIDC INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_EDPAR LIKE STANDARD TABLE OF EDPAR INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_KNA1 LIKE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_ADRC LIKE STANDARD TABLE OF ADRC INITIAL SIZE 0 WITH HEADER
LINE.
DATA: INT_PDF TYPE TABLE OF TLINE WITH HEADER LINE.
DATA : BEGIN OF TB_ED OCCURS 0,
SNDPRN LIKE EDIDC-SNDPRN,
LOC LIKE ADRC-BUILDING,
DOCNUM LIKE EDIDC-DOCNUM,
IDOCTP LIKE EDIDC-IDOCTP,
MESTYP LIKE EDIDC-MESTYP,
DIRECT LIKE EDIDC-DIRECT,
CREDAT LIKE EDIDC-CREDAT,
STATUS LIKE EDIDC-STATUS,
END OF TB_ED.
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.
Job Runtime Parameters
DATA: GD_EVENTID LIKE TBTCM-EVENTID,
GD_EVENTPARM LIKE TBTCM-EVENTPARM,
GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
GD_JOBNAME LIKE TBTCM-JOBNAME,
GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
DATA: W_RECSIZE TYPE I,
W_SPOOL_NR LIKE SY-SPONO.
%_print LIKE pri_params.
DATA: GD_SUBJECT LIKE SODOCCHGI1-OBJ_DESCR,
IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
GD_SENDER_TYPE LIKE SOEXTRECI1-ADR_TYP,
GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
Spool to PDF conversions
DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
GD_DESTINATION LIKE RLGRAP-FILENAME,
GD_BYTECOUNT LIKE TST01-DSIZE,
GD_BUFFER TYPE STRING.
Binary store for PDF
DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF IT_PDF_OUTPUT.
DATA: GD_RECSIZE TYPE I.
CONSTANTS: C_DEV LIKE SY-SYSID VALUE 'DEV',
C_NO(1) TYPE C VALUE ' ',
C_DEVICE(4) TYPE C VALUE 'LOCL'.
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.
DATA : MSTR_PRINT_PARMS LIKE PRI_PARAMS,
MC_VALID,
P_REPID LIKE SY-REPID,
WF_ID LIKE TSP01-RQIDENT,
LOC_BYTECOUNT TYPE I.
*start-of-selection.
MSTR_PRINT_PARMS-PDEST = 'LOCL'.
P_REPID = SY-REPID.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority= ' '
COPIES = '1'
COVER_PAGE = SPACE
DATA_SET = SPACE
DEPARTMENT = SPACE
DESTINATION = 'LP01'
EXPIRATION = '1'
IMMEDIATELY = 'X'
LAYOUT = 'X_65_132'
MODE = SPACE
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = MSTR_PRINT_PARMS
VALID = MC_VALID
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS MSTR_PRINT_PARMS.
AND RETURN.
NEW-PAGE PRINT ON NO DIALOG PARAMETERS
MSTR_PRINT_PARMS.
perform data.
NEW-PAGE PRINT OFF. "This marks the end of the screen for which the
*SPOOL NO WAS GENERATED.
WF_ID = SY-SPONO.
*converting spool to pdf
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = WF_ID "SPOOL NUMBER
NO_DIALOG = SPACE
PDF_DESTINATION = 'X'
IMPORTING
PDF_BYTECOUNT =
LOC_BYTECOUNT "NUMBER OF BYTES TRANSFERRED
TABLES
PDF = INT_PDF "TABLE FOR PDF REPORT
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
*CALL FUNCTION 'DOWNLOAD'
*EXPORTING
*bin_filesize = loc_bytecount "NO. OF BYTES
*filename = 'C:/EMAILPDF.PDF'
*filetype = 'BIN'
**IMPORTING
**act_filename = loc_filename
*TABLES
*data_tab = int_pdf.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
Transfer the 132-long strings to 255-long strings
LOOP AT INT_PDF.
TRANSLATE INT_PDF USING ' ~'.
CONCATENATE GD_BUFFER INT_PDF INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
CHECK GD_RECSIZE > 0.
PERFORM SENDMAIL USING P_EMAIL..
*& Form sendmail
text
--> p1 text
<-- p2 text
FORM SENDMAIL USING P_EMAIL.
CHECK NOT ( P_EMAIL IS INITIAL ).
REFRESH IT_MESS_BOD.
Default subject matter
GD_SUBJECT = 'Subject'.
GD_ATTACHMENT_DESC = 'IDOC LIST'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
If no sender specified - default blank
IF P_SENDER EQ SPACE.
GD_SENDER_TYPE = SPACE.
ELSE.
GD_SENDER_TYPE = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESS_BOD
IT_MESS_ATT
USING P_EMAIL
'Document attachment'
'PDF'
GD_ATTACHMENT_NAME
GD_ATTACHMENT_DESC
P_SENDER
GD_SENDER_TYPE
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM. " sendmail
*& Form DELETE_SPOOL
text
--> p1 text
<-- p2 text
FORM DELETE_SPOOL.
DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
LD_SPOOL_NR = WF_ID. "GD_SPOOL_NR.
CHECK P_DELSPL <> C_NO.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
SPOOLID = LD_SPOOL_NR.
ENDFORM. " DELETE_SPOOL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
text
-->P_IT_MESS_BOD text
-->P_IT_MESS_ATT text
-->P_P_EMAIL text
-->P_0846 text
-->P_0847 text
-->P_GD_ATTACHMENT_NAME text
-->P_GD_ATTACHMENT_DESC text
-->P_P_SENDER text
-->P_GD_SENDER_TYPE text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES IT_MESSAGE
IT_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.
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.
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.
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[] = IT_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 = p_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
W_SENT_ALL = 'X'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_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
object_header = objhead
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Error occurred while sending'.
ELSE.
MESSAGE I000 WITH 'The document was sent'.
ENDIF.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form data
text
--> p1 text
<-- p2 text
FORM data.
SELECT SNDPRN
DOCNUM
IDOCTP
MESTYP
DIRECT
CREDAT
STATUS
FROM EDIDC
INTO CORRESPONDING FIELDS
OF TABLE TB_EDIDC
WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
SELECT KUNNR
INPNR
FROM EDPAR
INTO CORRESPONDING FIELDS
OF TABLE TB_EDPAR
FOR ALL ENTRIES IN TB_EDIDC
WHERE KUNNR = TB_EDIDC-SNDPRN.
SELECT KUNNR
ADRNR
FROM KNA1
INTO CORRESPONDING FIELDS
OF TABLE TB_KNA1
FOR ALL ENTRIES IN TB_EDPAR
WHERE KUNNR = TB_EDPAR-INPNR.
SELECT ADDRNUMBER
BUILDING
FROM ADRC
INTO CORRESPONDING FIELDS
OF TABLE TB_ADRC
FOR ALL ENTRIES IN TB_KNA1
WHERE ADDRNUMBER = TB_KNA1-ADRNR.
LOOP AT TB_EDIDC WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
TB_ED-SNDPRN = TB_EDIDC-SNDPRN.
TB_ED-DOCNUM = TB_EDIDC-DOCNUM.
TB_ED-IDOCTP = TB_EDIDC-IDOCTP.
TB_ED-MESTYP = TB_EDIDC-MESTYP.
TB_ED-DIRECT = TB_EDIDC-DIRECT.
TB_ED-CREDAT = TB_EDIDC-CREDAT.
TB_ED-STATUS = TB_EDIDC-STATUS.
READ TABLE TB_EDPAR WITH KEY KUNNR = TB_EDIDC-SNDPRN.
READ TABLE TB_KNA1 WITH KEY KUNNR = TB_EDPAR-INPNR.
READ TABLE TB_ADRC WITH KEY ADDRNUMBER = TB_KNA1-ADRNR.
TB_ED-LOC = TB_ADRC-BUILDING.
APPEND TB_ED.
ENDLOOP.
WRITE :/02 'CustomerNo',
15 'Location Code',
30 'Idoc Number',
55 'Basic Type',
70 'Message Type',
95 'Direction',
110 'Received Date',
130 'Status'.
ULINE.
LOOP AT TB_ED.
WRITE :/02 TB_ED-SNDPRN,
15 TB_ED-LOC,
30 TB_ED-DOCNUM,
55 TB_ED-IDOCTP,
70 TB_ED-MESTYP,
95 TB_ED-DIRECT,
110 TB_ED-CREDAT,
130 TB_ED-STATUS.
ENDLOOP.
ENDFORM. " data
Kindly help me in solving the issue.
Thanks in advance.
Suki.Hi,
Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
Regards,
Renjith Michael. -
Reader XI: An Error Occurred While Sending Email
Please help. I am working on a Windows XP computer (SP3, fully updated) with Microsoft Office Outlook set as the default email.
I recently updated this computer to Adobe Reader XI. Whenever the user tries to "Send File as Eamil Attachment" (either using the button or using the File menue option) they get an Adobe Reader message "An error occured while sending email."
I've checked every setting I can think of. Under Preferences - Internet - Internet Settings - Programs, her email is set as Outlook. I tried uninstalling and reinstalling Adobe. I've tried removing and re-adding the Outlook account. I've chcekd for viruses and malware. What else could be causing this problem? I haven't seen this happen on any of our other XP machines.hi,
I have updated from reader x to xi, now outlook 2010 users can no longer attach emails, this use to work fine. I posted this issue elsewhere where someone had trouble with outlook 2003. Outlook either opens up with no attachment or nothing happens at all.
If can help
thanks
Robert -
MailServiceHelper Failed while sending email java.lang.NullPointerException
Hi guys,
I am trying to send email with Adobe CQ API.
But i am getting a nullpointer exception at this line: MsgGateway.send(htmlEmail);
This is my method that i am using to send.
import com.day.cq.mailer.MessageGateway;
import com.day.cq.mailer.MessageGatewayService;
import javax.mail.internet.InternetAddress;
public boolean sendHtmlEmail(SlingHttpServletRequest sling,
String fromMailAdress, List<String> recepientmailAddress,
String emailSubject, String htmlbodyMail) {
HtmlEmail htmlEmail = new HtmlEmail();
List<InternetAddress> emailAddress = new ArrayList<InternetAddress>();
try {
for (String recipient : recepientmailAddress) {
if (!StringUtil.isEmpty(recipient)) {
emailAddress.add(new InternetAddress(recipient));
log.error(recipient);
if (!StringUtil.isEmpty(fromMailAdress)) {
htmlEmail.setFrom(fromMailAdress);
htmlEmail.setTo(emailAddress);
htmlEmail.setSubject(emailSubject);
htmlEmail.setHtmlMsg(htmlbodyMail);
htmlEmail.setCharset("utf-8");
MessageGatewayService MsgService = getMessageGateWayService(sling);
MessageGateway<HtmlEmail> MsgGateway = MsgService.getGateway(HtmlEmail.class);
MsgGateway.send(htmlEmail); //nullpointer exception caught here
return true;
} catch (Exception e) {
log.error("Failed while sending email", e);
return false;
I have checked to ensure the bundle com.day.cq.cq-mail and my own bundle is running .
I am also sure that 'htmlEmail' is not null by retrieving the email subject via .getSubject and it did return me the subject.
I do not understand what is returning the nullpointerexception.
Thanks in advance !The MessageGateway instance (MessageGateway<HtmlEmail> MsgGateway) is null therby throwing a null pointer.
Instead of instanciating msgGateway as :
MessageGatewayService MsgService = getMessageGateWayService(sling);
MessageGateway<HtmlEmail> MsgGateway = MsgService.getGateway(HtmlEmail.class);
Inject your MessageGateway as:
@Reference
private MessageGateway<HtmlEmail> msgGateway;
and then call send on msgGateway as msgGateway.send(htmlEmail)
~ Aditya -
Error while sending email using TemplateEmailSender in CSC server
Hi,
We are trying to send email using TemplateEmailSender from CSC server. But it is giving Null Pointer Exception in ProfiledMessageSource like below. The same code is working fine in commerce instance but it is failing in CSC instance. We are using ATG2007.1p3
Any pointers would be helpful.
Below is the error.
Error while sending email
java.lang.NullPointerException
at atg.userprofiling.dms.ProfiledMessageSource.isConfiguredForProfileSubject(ProfiledMessageSource.java:196)
at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:864)
at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:848)
at atg.userprofiling.SessionEventTrigger.nameContextElementPreUnbound(SessionEventTrigger.java:553)
at atg.nucleus.GenericContext.sendPreUnboundEvent(GenericContext.java:200)
at atg.nucleus.GenericContext.preNotifyRemovedObject(GenericContext.java:528)
at atg.nucleus.GenericContext.removeElement(GenericContext.java:566)
at atg.servlet.SessionNameContext.unbindFromNameContext(SessionNameContext.java:557)
at atg.servlet.SessionNameContext.stopSession(SessionNameContext.java:534)
at atg.servlet.SessionNameContext.decrementWrapperCount(SessionNameContext.java:242)
at atg.servlet.SessionBindingReporter.valueUnbound(SessionBindingReporter.java:206)
at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1625)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:749)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:655)
at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1100)
at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
at atg.userprofiling.email.TemplateInvoker$TemplateSession.endSession(TemplateInvoker.java:935)
at atg.userprofiling.email.TemplateEmailSender.createMessage(TemplateEmailSender.java:2387)Thanks for the reply.
My issue is fixed now. It is JBOSS configuration issue. Sessions are not maintained properly that's why we are getting NULL profile in the session. Our application has multiple WARs so we fixed it by setting emptySessionPath to TRUE. If emptySessionPath attribute in server.xml is false, then each WAR will have its own jsessionid cookie.
I did not touch ProfiledMessageSource as its required for session triggering. -
Authentication Error while Sending Email from SMTP server.
Authentication Error while Sending Email from SMTP server. Can receive emails but cannot send emails from this account.
no email account was setup on the phone unless it was issued by your company.
gmail is required but no server address ports to enter.
my gmail account was setup before i took delivery of the phone but could have been done when phone was activated.
i added cox pop3 email and had to manually enter both pop3 and smtp servers with both boxes checked on both servers.
i doubt if it's a verizon issue. -
How do I create a dropdown in the Subject Line field while sending emails.
How do I create a dropdown in the Subject Line field while sending emails as I send more than 300 emails with the same subject line everyday.
Which webmail service do you use, gmail may have problems currently see thread
'' Subject autofill feature stopped working in gmail for new subjects only - and I'm not the only one - help! {[https://support.mozilla.com/en-US/questions/793610 link]]''
For general information see [[form autocomplete]] and [[Form autocomplete entries are not saved ]] -
TS3899 I am unable to attach any files while sending mail
Please tell me how to attach any word or pic or audio file while sending a mail using MAIL in my iphone 4.
Step 1
Remove "MacKeeper" as follows. First, back up all data.
"MacKeeper" has only one useful feature: it deletes itself.
Note: These instructions apply to the version of the product that I downloaded and tested in early 2012. I can't be sure that they apply to other versions.
IMPORTANT: "MacKeeper" has what the developer calls an “encryption” feature. In my tests, I didn't try to verify what this feature really does. If you used it to “encrypt” any of your files, “decrypt” them before you uninstall, or (preferably) restore the files from backups made before they were “encrypted.” As the developer is not trustworthy, you should assume that the "decrypted" files are corrupt unless proven otherwise.
In the Finder, select
Go ▹ Applications
from the menu bar, or press the key combination shift-command-A. The "MacKeeper" application is in the folder that opens. Quit it if it's running, then drag it to the Trash. You'll be prompted for your login password. Click the Uninstall MacKeeper button in the dialog that appears. All the functional components of the software will be deleted. Reboot.
☞ Quit MacKeeper before dragging it to the Trash.
☞ Don't empty the Trash. Let MacKeeper delete itself.
☞ Don't try to drag the MacKeeper Dock icon to the Trash.
Step 2
From the Safari menu bar, select
Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
and confirm. Test. -
String gets added to the name of the PDF while sending email
Hi,
I am generating a PDF from a smartform. When i click on the email button on the PDF, it opens outlook with the PDF in the attachment. But i can see some string gets added to the begining of the name of PDF for example if i have named the PDF as 18000012 then while sending email from PDF i can see the name as XXXXX1800012.pdf as the attachment. Is there any way by which i can remove that string.
Thanks,
SonalYou can use text variables in the report description
-
Appending multiple *.csv files while retaining the original file name in the first column
Hi guys it's been awhile.
I'm trying to append multiple *.csv files while retaining the original file name in the first column, the actual data set is about 40 files.
file a.csv contains:
1, line one in a.csv
2, line two in a.csv
file b.csv contains:
1, line one in b.csv
2, line two in b.csv
output.csv result is this:
I would like this:
a.csv, 1, line one in a.csv
a.csv, 2, line two in a.csv
b.csv, 1, line one in b.csv
b.csv, 2, line two in b.csv
Any suggestions to speed up my hobbling attempts would be aprieciated
Thanks,
-SS
Solved!
Go to Solution.What you could do is given in the attachment.
Started with 2 files :
a.csv
copy of a.csv
Both with data :
1;1.123
2;2.234
3;3.345
Output :
a.csv;1;1.123
a.csv;2;2.234
a.csv;3;3.345
Copy of a.csv;1;1.123
Copy of a.csv;2;2.234
Copy of a.csv;3;3.345
If you have more questions, just shoot
Kind regards,
- Bjorn -
Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's
LabVIEW 5.1 - LabVIEW 2012
Attachments:
AppendingCSV.JPG 73 KB -
Converting html file into zip file and send email attaching zip file
Hi Experts,
I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
So, Now i need to compress the data for less than 7MB.
I decided to convert HTML File into ZIP File.
Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
Correct answer rewarded,
Thanks & Regards,
N. HARISH KUMARHi Experts,
*// HTML_TAB converting into ZIP File
DATA : zip_tool TYPE REF TO cl_abap_zip,
filename TYPE string ,
filename_zip TYPE string .
DATA : t_data_tab TYPE TABLE OF x255,
bin_size TYPE i,
buffer_x TYPE xstring,
buffer_zip TYPE xstring.
filename = text-007. "'HTML_TAB
*describe the attachment
DESCRIBE TABLE html_tab LINES tab_lines.
bin_size = tab_lines * 255.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = bin_size
IMPORTING
buffer = buffer_x
TABLES
binary_tab = html_tab.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*create zip tool
CREATE OBJECT zip_tool.
*add binary file
CALL METHOD zip_tool->add
EXPORTING
name = 'FSSAI_MAIL.HTML'
content = buffer_x.
*get binary ZIP file
CALL METHOD zip_tool->save
RECEIVING
zip = buffer_zip.
CLEAR: t_data_tab[],bin_size.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = buffer_zip
IMPORTING
output_length = bin_size
TABLES
binary_tab = html_tab.
Thanks & Regards,
N. HARISH KUMAR -
Skip Terms and Conditions while sending Email
Hello Experts,
I have a requirement to print the line items of Sales order in front page and Terms and Conditions on back of every page. I need to send the same document as an Email, but without Terms and Conditions.
I could achieve printing part by creating another Master Page for Terms and Conditions and by enabling the page set to print on both sides and there by setting front page and back page properties.
But I could not avoid the back page template while sending email..
Could you please help me to let me know, where I am commiting mistake or else please suggest me if any other method is available for this requirement.
Thanks,
RakeshThanks Andres, for your reply. I accept your solution will definetly work, but client over here, will not accept maintaining two objects of similar kind.
Thanks,
Rakesh -
Leading zeros in CSV file.
Hi Team,
I need to retain leading zeros in CSV file.
I could eliminate this problem in XLS file by using this tag in the RTF Template:
<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><?XML_ELEMENT?></fo:bidi-override>.
So, when i do an Export from Publisher for excel document its gives me correct values. i.e zeros are retained.
But when i select "CSV" and then hit Export , it gets saved in txt file and the txt file has the zeros.
but when i rename it to ".csv" and open it does not retain zeros.
Can you please let us know how can we achieve this.
Thanks for help!
Bhupendra GuptaHi Bhupendra,
If its a number the leading zeros will be eliminated in CS in the default CSV .can't do much on this.
But if use the delimiter e-text and get the output file, you can get the leading zeros as needed..
Follow this
http://winrichman.blogspot.com/2009/09/delimiter-based-e-text.html
http://winrichman.blogspot.com/search/label/BIP%20E-text
Maybe you are looking for
-
In Pages 09' how do I change the background colors on the templates?
I have been trying to change the background on one of the templates from red to green for a while. I can't figure it out and i can't find answers online any where that are helpful at all. I just need to changes the background color to what I want i
-
Question regarding Nokia Asha 309, pls. answer
Hi , I'm new here. I was planning to buy a nokia asha 309 and I want to ask some things. -How is the performance in this phone? is it good? -how about the gaming? does it lag like the asha 305?? -how about the screen? is it responsive?? thanks, I hop
-
Crystal Reports 12 merge module fails ICE validation during installation
Hi there, I am using the CR 2008 merge module that I downloaded from this site, and am using MSI Factory 2.0 to install my product. The ICE validation fails during the build with the following errors. C:\v9.wxs(6680) : warning LGHT1056 : The Directo
-
I have a new macbook pro with 4GB ram and a 3.06Ghz core duo processor. I use Logic Pro Studio with 2 Motu 896mk3's after recording about 13 tracks I am now getting "disk too slow errors" After using activity monitor it doesn't seem to be a cpu or ra
-
Interconnection Imac-G4-800Mhz-OS 10.4.11, and IPODCLASSIC.
I want to offer a IPOD Classic to my daughter who has a IMAC - G4 - 800 MHz (version swell - 17 inches). This Mac currently turns with OS 10.4.11 and will remain on this level with version 9 of ITUNES. At that time, it is sure that the USB exits are