Greylisted address
I am trying to send mail from my .mac address using Mail (os x 10.4.11) and get the follwoing message from the [email protected] :
Sun, 26 Oct 2008 16:43:31 -0700 (PDT)
[email protected]: smtp;450 <[email protected]>: Recipient address rejected: Greylisted, see http://isg.ee.ethz.ch/tools/postgrey/help/mic.gov.mz.html
This seems to imply that either Apple or I is using a grey listing tool that won't permit sending to the intended address.
Is there any way I can get the intended recipient off the grey list? The link indicted in the message does not tell me anything I can understand....
thks
jw
Message was edited by: James Wilson
Ask the adminstrator of the Mozambique e-mail server blocking you to unblock you.
Make sure that:
1. Your e-mail address is only known to people in the government agencies.
2. You never use it for eCommerce external to the government.
3. The people you communicate with are protecting their machines against spammer viruses.
4. Your e-mail address is never used for sending or receiving chain letters.
5. If you have to use eCommerce for the government, make sure that the website sneding you information regarding your purchases has your "notify me of further offers" and similar options unchecked.
Similar Messages
-
Milter-greylist and Messaging Server
I have been using the milter-greylist for a long time on the sendmail servers and relays, and at least with the older releases I thought this milter only supports local sockets to interact with sendmail (and can listen on the network for peering with other milter-greylist instances). I reviewed the recent release's README, there's no notes of non-local sockets either.
The Wiki [http://msg.wikidoc.info/index.php/About_milter_plugin] suggests, however, that all milters may (and for Messaging Server - must) be configured on a networking socket. It also states that milter-greylist was tested as working with the Sun Messaging Server.
Can somebody please elaborate (ideally - write up a step-by-step how-to on the Wiki) how to integrate this milter with Sun MS, which versions are supported, where do we configure the network-listening socket (is it greylist config or libmilter config), etc.?
Thanks in advance :)JimKlimov wrote:
The Wiki [http://msg.wikidoc.info/index.php/About_milter_plugin] suggests, however, that all milters may (and for Messaging Server - must) be configured on a networking socket. It also states that milter-greylist was tested as working with the Sun Messaging Server.
I hit this very issue when writing up the guide you refer to -- there is little in the way of information on the Internet regarding the sendmail milter library and getting the milter to listen on a non-unix socket.
Can somebody please elaborate (ideally - write up a step-by-step how-to on the Wiki) how to integrate this milter with Sun MS, which versions are supported, where do we configure the network-listening socket (is it greylist config or libmilter config), etc.?For the milter-greylist I made the following change to the greylist.conf file:
replace:
socket "/var/milter-greylist/milter-greylist.sock"
with:
socket "inet:19025"This causes the milter to listen on an INET port (19025 in this example) vs. a unix socket. You will find that a similar approach will work with other milters that use the sendmail milter library and this is why I mentioned it in the guide:
<snip>
3. Run the milter-server, configure it to run on the INET:<TCP port number> socket.
</snip>
As for writing up wiki's on supported versions and what-not (we don't support specific milters rather we support the milter interface) this is something I simply don't have the time to do. Feel free however to update the milter wiki page with your own testing results.
I did however fix up a number of broken links on the page -- it seems sendmail have moved their milter related information to a new site (milter.org) since I created the page.
If you are looking at greylisting addresses, I would recommend you consider using the following instead as it is far more efficient then calling out to a milter server for this purpose.
http://code.google.com/p/gross/wiki/readme
http://iamthek.com/archives/30
Regards,
Shane. -
Mail from one email address won't download
Emails from one particular email address won't download into Mail for my [email protected] account. Email from everyone else comes in fine. I can see his mail in webmail and on my iPhone, but not in Mail. It comes through to my yahoo address but not my main address. Here are the headers from one of his emails, hopefully someone will have an idea how to fix this.
Thanks!!
Paula
From [email protected] Tue Sep 9 00:27:52 2008
Received: from p02c11m066.mxlogic.net (mxl144v245.mxlogic.net [208.65.144.245])
by host2.52601.com (8.12.11.20060614/8.12.10) with ESMTP id m894Rqa2031890
for <[email protected]>; Tue, 9 Sep 2008 00:27:52 -0400
Received: from unknown [207.172.157.102] (EHLO smtp02.lnh.mail.rcn.net)
by p02c11m066.mxlogic.net (mxl_mta-5.7.0-1)
with ESMTP id 84bf5c84.3171756976.300217.00-037.p02c11m066.mxlogic.net (envelope-from <[email protected]>);
Mon, 08 Sep 2008 22:27:52 -0600 (MDT)
Received: from mr02.lnh.mail.rcn.net ([207.172.157.22])
by smtp02.lnh.mail.rcn.net with ESMTP; 09 Sep 2008 00:27:52 -0400
Received: from smtp01.lnh.mail.rcn.net (smtp01.lnh.mail.rcn.net [207.172.4.11])
by mr02.lnh.mail.rcn.net (MOS 3.8.6-GA)
with ESMTP id PAK98602;
Tue, 9 Sep 2008 00:27:51 -0400 (EDT)
Received: from host-sse217.res.openband.net (HELO S0032027583) ([216.40.64.217])
by smtp01.lnh.mail.rcn.net with ESMTP; 09 Sep 2008 00:27:51 -0400
Reply-To: <[email protected]>
From: "R&R Traders" <[email protected]>
To: "PIERCE PAULA" <[email protected]>
Cc: <[email protected]>
Subject: WEAPON PAGE
Date: Tue, 9 Sep 2008 00:27:53 -0400
Organization: R & R Traders
Message-ID: <UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAEyNd+5kkh06d3llPqgzVwsKAAAAQAAAAF/aL [email protected]>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_reb-r1E746C67-t48C5FB48"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook, Build 10.0.6838
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Thread-Index: AckSNGzaztKPqy6gS1+R4u4O72TkMA==
Disposition-Notification-To: "R&R Traders" <[email protected]>
X-Junkmail-Status: score=10/50, host=mr02.lnh.mail.rcn.net
X-Junkmail-SD-Raw: score=unknown,
refid=str=0001.0A010207.48C5FB47.01B1,ss=1,fgs=0,
ip=207.172.4.11,
so=2007-10-30 19:00:17,
dmn=5.4.3/2008-02-01
X-Junkmail-IWF: false
X-Processed-By: Rebuild v2.0-0
X-Spam: exempt
X-MAIL-FROM: <[email protected]>
X-SOURCE-IP: [207.172.157.102]
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (host2.52601.com [65.108.5.169]); Tue, 09 Sep 2008 00:27:52 -0400 (EDT)
Status: R
Paula,
I sent two different photos. The same photo has been placed in both boxes.
RayIt's not the images that aren't downloading, it's the entire email. His email just doesn't show up in Mail, like it was never sent at all.
I access [email protected] through Mail app.
Not sure about winmail.dat... and not sure what program he uses to send mail.
Some of his mail gets through, some doesn't. Doesn't seem to be any reason. It's not always emails with attachments that don't get through. Sometimes it's just a plain text email that doesn't get through.
Thanks,
Paula -
Greylisted in 10.4.8
I got this message in my mail.log
Recipient address rejected: Greylisted for 300 seconds
Does this mean i have a greylist system in my mailserver? i hav not installed postgrey or anything like that!??If you haven't installed then it is the other way around. One of your users has sent an email to a mailserver that does greylisting.
Next time please post the relevant and unmodified log entries. My psychic powers only work during solar elipses -
Botnet in 5505 ASA v9.2 - Manual entered Blacklist is only Greylisted
Any help is appreciated, I know not a lot of people are running the botnet but after using it on a trial basis I was hooked so I would like to know if this is a but or a setting where blacklisted traffic levels are defined.
I may have had this issue in other versions and not noticed it.
I have two issues, first is manually putting entries into my blacklist section for example:
dynamic-filter blacklist
name www.sprint.com
Are only being Greylisted so when I test I am still able to get to the webpage because I only block high to very high traffic.
Looking at the monitor it shows that the website was only Greylisted any my filter level was set to only block high and very high threats.
Documentation says manual entries in the blacklist are considered Very High but my system only categorizes them as Greylist.
My current workaround is to go under
Botnet traffic filter
Traffic Settings
and select the checkbox for "Treat ambiguous (greylisted) traffic as malicious (blacklisted) traffic
The problem is I may now get false positives.
My other question is can I set the ASA to display a page saying "Blocked by Botnet" or redirect traffic to my internal webserver so I can create that page? Merely blocking a page without definition can cause some frustration.
Can anyone else who has this take a peek to see if this is the same or did I jack one of my settings?
Here is some of my config
threat-detection basic-threat
threat-detection statistics
threat-detection statistics tcp-intercept rate-interval 30 burst-rate 400 average-rate 200
dynamic-filter updater-client enable
dynamic-filter use-database
dynamic-filter enable interface inside
dynamic-filter enable interface outside
dynamic-filter enable interface dmz
dynamic-filter drop blacklist interface outside threat-level range high very-high
dynamic-filter ambiguous-is-black
dynamic-filter whitelist
name vc.dwwtc.com
address 111.221.77.150 255.255.255.255
address 157.55.177.46 255.255.255.255
name centos.mirrors.hoobly.com
address 66.160.172.98 255.255.255.255
address 69.63.190.0 255.255.255.0
address 205.244.201.221 255.255.255.255
dynamic-filter blacklist
name www.sprint.comHello;
That is indeed a feature that we can consider. If you have a Cisco representative, I would strongly suggest you talk to him and request the feature. By now there is no redirect page or block page for botnet.
In regards to the other query. If the site appears to be good on our database, but you categorize is as black, the site would turn out to be grey, the way to drop this would be applying "grey is alway black" which is the option you have.
Mike. -
ICal Server won't send invites to e-mail addresses
Set up a new 10.7.2 Server, enabled OD, added 6 users. Set up iCal Server, everything works fine between OD users. Problem is when you try to share a calendar with an e-mail address for someone outside the company, iCal comes back with "The server returned an error" and "Mail gateway didn't find a token in message" shows up in the iCal Server log.
We created a new dedicated e-mail account on their mail server (hosted by their ISP, not by the server I just installed) and put all the info into the iCal settings in the Server app. As far as I can tell that part is working. I also tried creating a Gmail account, but I get the same errors.
Google hasn't been much help. Only reference to the token error was from someone else's calendar server application, and wanted me to edit caldavd.plist (I checked the settings there just in case, and it all is correct.)
The server is hostings DNS for itself, but all other DNS info is being provided by their Airport Extreme.
-ZToday I reloaded the server in question. Downloaded 10.7.3 via the Recovery Partition, restored the OD archive, and tried to set up iCal. I have exactly the same problem.
I set up a calendar on a Lion client, and try to set it to share with someone who has an OD account. The sharing dialog closes, but no invite is ever sent. If I try to share with someone who is not in OD, I get error messages in the server log.
An entire afternoon of Googling shows a lot of people are having the same problem. Best I can tell, it seems to happen if your e-mail server is hosted elsewhere, as if iCal Server assumes that the mail server is on the same Mac. This is not the case with this setup. Their web page and domain are hosted outside as well, but we have a DNS entry made so server.domain.com forwards to the Mac Mini server inside their office. We've tested this for VPN, Remote Desktop, and FileMaker access, and all work fine.
I've tried two types of configurations, neither of which is working.
1. Created an [email protected] account with their mail host. I used that outside mail server information for IMAP / SMTP settings, but every time I try to share a calendar the iCal error log shows IMAP login errors. Their mail server does not use SMTP authentication. They have the option to use SSL or not, but neither work.
2. Used [email protected], and used the default localhost server info. I then tried to set up the server's built in Mail server to forward mail to their outside mail host. This started giving me
[mailgateway] 2012-04-05 19:51:05-0400 [IMAP4DownloadProtocol,client] Unhandled unsolicited response: ['OK', ['HIGHESTMODSEQ', '1'], 'Highest']
I now get that error no matter what I do, meaning something broke again.
I've gone through several Google pages referring to greylisting, the postfix, etc, but since the server is not running a Mail server, none of these apply.
I have no idea what I am doing wrong. Lion has been out a year, surely in that time this has been worked out. So why can't I find a solution? Everywhere I look it's either a thread starting out with the same problem I am having, followed by a dozen or so "me too" posts, or it's someone saying they managed to make it work, but their fix doesn't work for me. I'm really frustrated right now, and so is my customer.
Oh, almost forgot... now we have a new problem. FileMaker Admin requires access to port 16000, but for whatever reason the server is blocking that port. It's not running a firewall. Good to know that reloading causes more problems than it solves. -
So, I get that 10.6 implements greylisting. Unfortunately it's not working all that well for one of the folks sending to my mail server - ironically from mac.com. Since upgrading his mail always takes an hour to be delivered.
Is there any way I can specify either a specific address, or failing that, a domain to be whitelisted? In other words, how do I specify what should be exempt from greylisting?
I don't want to turn off greylisting - it's made a large improvement in the amount of spam we get.The greylist policy service is located here:
/usr/libexec/postfix/greylist.pl
It is almost a clone of the example postfix greylist policy example from here:
http://www.postfix.org/SMTPDPOLICYREADME.html
For what it is worth, the greylisting server never clears the database it uses to store which client addresses have tried to deliver mail to it, so once an address is whitelisted it should stay whitelisted forever. So delivery delays should go away with time as the full range of possible servers from places like mac.com and gmail get remembered.
If you're adventurous and know some perl, it should be straightforward to modify greylist.pl to check a whitelist file. -
I was not adding anything to Firefox. I Refused tool bars embedded in several application installs on this new computer. Was working fine. Then had a problem with Google search, restored default values and re-tooled Firefox. At this point all worked fine. Then my url, address bar changed color to the same color as the program shell, a grey brown as opposed to the white it was before. With the change in color it no longer allows me to change the data showing in the bar. I can not delete or add data. I used to add a url and navigate to the domain. Now I can not
Greetings,
TY for the reply, the information was enlightening to be sure. I never knew safe mode was an option with Firefox. I have so many tasks running that I didn't want to shut things down. What I did is turn off some of the last plug-ins I installed. That did not fix the problem at least in the first look. What happened next was very interesting none the less. I had a moment of mouse spastic wrist syndrome and accidentally moved a tab in such a way that it opened in a new window. The URL bar was white and editable. So I moved all my tabs to the new window and everything works as it should. I have restarted Firefox this morning and it came back with the bar editable and I am speechless to understand what I may have done to correct the problem if anything ?? -
Email address change--how does this affect laptop and nook?
I use my Adobe ID only to authorize my laptop and Nook. I need to change my email address which seems easy on the FAQs, but how do I then reauthorize my laptop and Nook? And, if I do this, are all my existing library books unreadable since they were downloaded by what the Nook thinks is a different user? I'm almost sure I won't be able to return any books in ADE on my laptop, but I can live with that if I can still read the books on the Nook.
Thanks in advance.The sync process with iTunes transfers the email account settings (for your chosen accounts via your iPhone sync preferences) from the Mail application on your Mac to the iPhone's email application.
The iPhone is running OS X and the iPhone's email client can be considered a mobile version of the Mail application. -
When I sign in to a site on my iPad using my email address as ID a short cut of my email address comes up. How can I get rid of it?
You can edit keyboard shortcuts in Settings>General>Keyboard>Shortcuts>Edit.
-
I am trying to use eprint and when I login it says my email address isnt registered
i am trying to use eprint, it says login, login says I am not registered, so I use create function, it says my email address in already in use, so I try retrieving password, then it says email address doesnt exist. so I can not use eprint.
Hi,
I would guess this is an AIM valid Screen Name such as an Apple issued @mac.com account.
I would also guess you travel to other countries.
There have been several posts about @mac.com names and people who travel and use their Screen Name elsewhere having the name Suspended.
Can you Log in here https://settings.aim.com/ ?
Is this where you saw the Suspended message ?
For AIM issued name the answer is to change your Password as this tends to prove you own the account.
This does not work for Apple IDs used as AIM Valid Screen Names as AIM can't tell when the password is changed (They can only see it when you log in)
AIM's Suspended Account page has an email ([email protected]) on it to contact if your account remains Suspended.
However you need to be very clear that you have an Apple Issued Name and that you know that resetting the password that works for AIM Names and that you would like them to reset the account.
More recently this has been a sticking point. It seems the Contact you get does not always know about the agreement that AIM recognises Apple Issued IDs as Valid Screen Names and that the AIM servers can only view the passwords at specific times (or at least confirm them) so you changing it will make no difference and that they have to step in manually.
10:39 PM Saturday; October 20, 2012
Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.2)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad
"Limit the Logs to the Bits above Binary Images." No, Seriously -
Please help - I am beginning to hate google, my android and gmail. I have just wasted about 5 hours in a futile attempt to try and get my current Mac contacts list on my computer updated to my phone. I'm not that computer literate but I have looked up about google phone accounts, vCards, backing up contact lists, what SD on phones are, and God know what else. I have searched the internet and tried all sorts of things and I still have a mac with a now correct contact list (after the iPad contacts scrambled it and I spent ages manually correcting them all) and a phone with an outdated contact list. If you try and sync them the phone wants to overwrite the computer one just like the iPad did (would it be so **** hard to give you a choice on the phone as to which overwrites which!). After all the advice on the internet failed, I got the bright idea to completely delete all the ones on the phone and if it was empty of contacts the computer one could be exported to it. Not as simple as it sounds. First I backed up (I think) my computer contacts list. Numerous futile attempts to go through the phone options to globally delete all contacts did not work - they gave a warning message and you got to choose whether to continue or not, I did, and it looked like it might be working as it changed to zero data on the phone, but then they all popped back up again from God knows where from, but without their little added bits like pictures of the people. So, I tried un- syncing the darn phone from google and then deleting them globally. That didn't work either. I tried deleting them all again and again and google would crash and not let me do it. It is absolutely ridiculous that this is so damned difficult to do (especially if you are not computer savvy) and that you cannot choose which device overwrites which when syncing. I gave up and ticked sync with Google again (not that it appears to do anything to the phone contact list at all). So after 5 hours I am back to where I started from, with a phone showing all the same incorrect contacts (but the pictures are back), which wants to overwrite the computer if I try any sort of sync, and no way to fix them except go into each one manually and try and do it - and how long would that take (and I've already wasted hours and hours fixing scrambled contact lists!). I think I will do a print out of the computer contact list and just carry it around with me like an address book - so much bloody simpler. So now I have a headache, am fighting an overwhelming urge to hurl the phone at the wall, hoping for a heat wave to evaporate icloud things and am wishing I had bought an iPhone instead of the stupid HTC Android. Can any one offer me any suggestions on how to get rid of the contacts on my phone and replace them with the ones in my mac address list - hopefully after that they can sync to their hearts content and not stuff everything up again (which was why I unsynced google a while back - because the phone's list kept making stuff ups and scrambling and duplicating my computer contacts list). Am I the only one on the planet having this problem or is there someone else out there who has had it and solved it.
Without "pretending" to be yourself on the other phone (change settings) there's nothing else you can do.
iOS devices are meant to be single user and can't view iCloud.com the same way a Mac or PC can do.
You need to find a desktop or laptop machine (Mac or PC) to log in at iCloud. -
My itunes account is attached to an email account that I no longer have and cannot retrieve. I have been having trouble with purchases made to my itunes account and want to view my purchases. The support center said that they would email me the purchase history. However, I don't have that email address. When I go to change my email address to my current one, I get a message in red saying that "the email address is already verified for another Apple I.D." I'm sure it is one of my devices as we have 4 ipods and 2 iphones. How can I get my account to use my current email address? If one of my devices was registered using my current email address as it apparently was, do I need to figure out which device that is and remove the email address from that account? I'm so confused. I just want ALL my devices to use my current email address. I need to replace the old email address with my current one. How do I do that?
thanks for any assistance.Your best bet would be to try resetting the password to the account that you would like to use via iForgot
Once you log in to that account change the email address to anything, it can even be fake its just a placeholder
After you do that you will be free to change your old email address on your appleID to the new one that is now free to be used as it is no longer attached to the other account. -
To add number of senders mail addresses
in the following code how there is one sender address how do i make it to 3 senders i mean add the number of senders
REPORT ZSPOOL5 NO STANDARD PAGE HEADING.
PARAMETER: P_EMAIL1 LIKE SOMLRECI1-RECEIVER,
P_SENDER LIKE SOMLRECI1-RECEIVER,
P_DELSPL AS CHECKBOX.
*ranges:
*DATA DECLARATION
DATA: GD_RECSIZE TYPE I.
Spool IDs
TYPES: BEGIN OF T_TBTCP.
INCLUDE STRUCTURE TBTCP.
TYPES: END OF T_TBTCP.
DATA: IT_TBTCP TYPE STANDARD TABLE OF T_TBTCP INITIAL SIZE 0,
WA_TBTCP TYPE T_TBTCP.
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.
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.
CONSTANTS:C_DEV LIKE SY-SYSID VALUE 'DEV',
C_NO(1) TYPE C VALUE ' ',
C_DEVICE(4) TYPE C VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
NEW-PAGE.
COMMIT WORK.
NEW-PAGE PRINT OFF.
IF SY-BATCH EQ 'X'.
PERFORM GET_JOB_DETAILS.
PERFORM OBTAIN_SPOOL_ID.
Alternative way could be to submit another program and store spool
id into memory.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM CONVERT_SPOOL_TO_PDF.
PERFORM PROCESS_EMAIL.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
IF SY-SYSID = C_DEV.
WAIT UP TO 5 SECONDS.
SUBMIT RSCONN01 WITH MODE = 'INT'
WITH OUTPUT = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM OBTAIN_SPOOL_ID.
CHECK NOT ( GD_JOBNAME IS INITIAL ).
CHECK NOT ( GD_JOBCOUNT IS INITIAL ).
SELECT * FROM TBTCP
INTO TABLE IT_TBTCP
WHERE JOBNAME = GD_JOBNAME
AND JOBCOUNT = GD_JOBCOUNT
AND STEPCOUNT = GD_STEPCOUNT
AND LISTIDENT <> '0000000000'
ORDER BY JOBNAME
JOBCOUNT
STEPCOUNT.
READ TABLE IT_TBTCP INTO WA_TBTCP INDEX 1.
IF SY-SUBRC = 0.
MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
GD_SPOOL_NR = WA_TBTCP-LISTIDENT.
MESSAGE S004(ZDD) WITH GD_SPOOL_NR.
ELSE.
MESSAGE S005(ZDD).
ENDIF.
ENDFORM. "obtain_spool_id
FORM get_job_details *
FORM GET_JOB_DETAILS.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
EVENTID = GD_EVENTID
EVENTPARM = GD_EVENTPARM
EXTERNAL_PROGRAM_ACTIVE = GD_EXTERNAL_PROGRAM_ACTIVE
JOBCOUNT = GD_JOBCOUNT
JOBNAME = GD_JOBNAME
STEPCOUNT = GD_STEPCOUNT
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
ENDFORM. "get_job_details
FORM convert_spool_to_pdf *
FORM CONVERT_SPOOL_TO_PDF.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = GD_SPOOL_NR
NO_DIALOG = C_NO
DST_DEVICE = C_DEVICE
IMPORTING
PDF_BYTECOUNT = GD_BYTECOUNT
TABLES
PDF = IT_PDF_OUTPUT
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.
CHECK SY-SUBRC = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT IT_PDF_OUTPUT.
TRANSLATE IT_PDF_OUTPUT USING ' ~'.
CONCATENATE GD_BUFFER IT_PDF_OUTPUT 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.
ENDFORM. "convert_spool_to_pdf
FORM process_email *
FORM PROCESS_EMAIL.
DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
CHECK GD_RECSIZE > 0.
PERFORM SEND_EMAIL USING P_EMAIL1.
perform send_email using p_email2.
ENDFORM. "process_email
FORM send_email *
--> p_email *
FORM SEND_EMAIL USING P_EMAIL.
CHECK NOT ( P_EMAIL IS INITIAL ).
REFRESH IT_MESS_BOD.
Default subject matter
GD_SUBJECT = 'Subject'.
GD_ATTACHMENT_DESC = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
IT_MESS_BOD = 'Message Body text, line 1'.
APPEND IT_MESS_BOD.
IT_MESS_BOD = 'Message Body text, line 2...'.
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
'Example .xls documnet attachment'
'PDF'
GD_ATTACHMENT_NAME
GD_ATTACHMENT_DESC
P_SENDER
GD_SENDER_TYPE
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM. "send_email
FORM delete_spool *
FORM DELETE_SPOOL.
DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
LD_SPOOL_NR = 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
Send email
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_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[] = 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 = 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. "send_file_as_email_attachmenthi ,
just loop at LD_SENDER_ADDRESS which is there in fm
'SO_DOCUMENT_SEND_API1' -
Address book .... importing text file
I am designing an address book which opens a text file called AddressBook.txt which reads in the information in the following format:
lastname,firstname,street,city,state,zip,phonenumber,birthday,persontype
lastname2,firstname2,street2,city2,state2,zip2,phonenumber2,birthday2,persontype2
etc. (with a maximum entries of 500)
I am having a problem reading in the information without the commas and wrapping to the next line. I can either use the BufferedReader or Scanner to input the file and as you can see below, my code is not complete yet. I can't figure out how to code the storeAddress() method in order to get the addressBookEntries[] to include the necessary information for outputting, sorting, etc. If I can get the information read into the addressBookEntries[], I think I will probably be able to proceed in the rest of the required tasks (i.e. sorting by last name, searching by last name, etc.)
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.SimpleDateFormat;
import java.io.*;
import java.lang.*;
* @created September 14, 2004
* This program uses a JFrame to manipulate data and form an
* address book. The user will be able to load data from a file,
* sort it by last name, print the address, phone number, and date
* of birth, print the names of people whos birthday are between 2
* dates, print the names of people between 2 last names, and/or
* print the names of different person types.
public class AddressBook extends JPanel implements ActionListener{
JFrame frame;
final int numButtons = 7;
JRadioButton[] radioButtons = new JRadioButton[numButtons];
JButton process = new JButton("Process Request");
JLabel title;
JTextArea output = new JTextArea(30,50);
int MAX_ADDRESS_ENTRIES = 500;
AddressBookEntry addressBookEntries[] =
new AddressBookEntry[MAX_ADDRESS_ENTRIES];
String FILE_NAME="AddressBook.txt";
public AddressBook(JFrame frame){
super(new BorderLayout());
this.frame=frame;
JPanel choicePanel = createSimpleDialogBox();
choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
" to choose from:"));
title = new JLabel("<html><h2> Thank you for opening the " +
"Address Book. " +
"Please Press the \"Process Request\" " +
"after making a choice.</h2></html>\n",JLabel.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
output.setEditable(false);
add(title, BorderLayout.NORTH);
add(choicePanel, BorderLayout.CENTER);
add(output, BorderLayout.SOUTH);
final ButtonGroup group = new ButtonGroup();
final String saveCommand = "Save";
final String sortByLN = "Sort by Last Name";
final String searchLNCommand = "Search By Last Name";
final String printAPD = "Print address, phone number, and DOB";
final String printNamesDOB = "Print names of people whose birthday" +
" falls between 2 dates";
final String printNamesLN = "Print names of people who fall" +
" between 2 last names";
final String printPType = "Print all family members, friends, or" +
" business associates";
private JPanel createSimpleDialogBox(){
radioButtons[0] = new JRadioButton(
"<html>Save the address file</html>");
radioButtons[0].setActionCommand(saveCommand);
radioButtons[1] = new JRadioButton(
"<html>Sort the address file by last name</html>");
radioButtons[1].setActionCommand(sortByLN);
radioButtons[2] = new JRadioButton(
"<html>Search the address file by last name</html>");
radioButtons[2].setActionCommand(searchLNCommand);
radioButtons[3] = new JRadioButton(
"<html>Print the address, phone number, and DOB of a specified" +
" person</html>");
radioButtons[3].setActionCommand(printAPD);
radioButtons[4] = new JRadioButton(
"<html>Print the names of people whose birthday falls between" +
" two dates</html>");
radioButtons[4].setActionCommand(printNamesDOB);
radioButtons[5] = new JRadioButton(
"<html>Print the names of people who fall between two" +
" specified last names</html>");
radioButtons[5].setActionCommand(printNamesLN);
radioButtons[6] = new JRadioButton(
"<html>Print all family members, friends, <u>OR</u>" +
" business associates</html>");
radioButtons[6].setActionCommand(printPType);
for (int i=0; i<numButtons; i++){
group.add(radioButtons);
//set the first button (open file) to be selected
radioButtons[0].setSelected(true);
return createPane(radioButtons, process);
private JPanel createPane(JRadioButton[] radioButtons,
JButton showButton) {
int numChoices = radioButtons.length;
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
for (int i = 0; i < numChoices; i++) {
box.add(radioButtons[i]);
JPanel pane = new JPanel(new BorderLayout());
pane.add(box, BorderLayout.NORTH);
pane.add(showButton, BorderLayout.SOUTH);
return pane;
public void actionPerformed(ActionEvent e) {
String command = group.getSelection().getActionCommand();
//else if button pushed is save
if (command == saveCommand){
// save file
//else if button pushed is search by last name
else if (command == sortByLN){
// search by last name
//else if button pushed is sort by last name
else if (command == searchLNCommand){
// sort by last name
// print to screen
//else if button pushed is display address, ph#, dob
else if (command == printAPD){
// display "search by last name" dialog
// search last names
// if last name found
// print data
// else
// print error notification "person not found"
//else if button pushed is list names of people whose
//bday between 2 days
else if (command == printNamesDOB){
// ask for which dates
// search bday
// print to screen
//else if button pushed is print names of people between 2 last names
else if (command == printNamesDOB){
// ask for which two last names
// search last names
// if people found
// print to screen
//else
//print error notification "no one found"
//else if button pushed is print all family members, friends
//or business associates
else if (command == printPType){
//ask for what person type
//search person types
//if people found
//print to screen
//else print "no one found"
public void storeAddress(File addressFile){
Scanner sc=null;
String lname,fname,street,city,state,zip,phone,persontype,bday;
try {
// Delimiters specifiy where to parse tokens in a scanner
sc = new Scanner(addressFile).useDelimiter("\\s*[\\p{,}*\\s+]\\s*");
catch (FileNotFoundException fnfe) {
JOptionPane.showMessageDialog(this,"Could not open the file");
System.exit(-1);
for(int i=0; i<MAX_ADDRESS_ENTRIES; i++){
while (sc.hasNext()) {
lname=(sc.next());
if (!lname.equals("")){
addressBookEntries[i].setLName()=lname;
public class AddressBookEntry{
private extPerson address;
private String date;
private extPerson ExtPerson;
public class Person{
protected String lastName, firstName;
private String address;
private String city;
private String state;
private String zipcode;
private String homephone;
private String extPersonType;
private Date bday;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
public String toString() {
return lastName+" "+firstName;
public void setLName(String last) {
lastName=last;
public void setFName(String first){
firstName=first;
public String getLastName() {
return lastName;
public String getFirstName() {
return lastName;
public Person() {
lastName="";
firstName="";
public Person(String first, String last){
setLName(last);
setFName(first);
//Set the address and return it
public void setAddress( String addr ){
address = addr;
public String getAddress(){
return address;
//set the city and return it
public void setCity( String town ){
city = town;
public String getCity(){
return city;
//set the state and return it
public void setState( String st )
state = st;
public String getState()
return state;
//Set the zip code and return it
public void setZipCode( String zip ){
zipcode = zip;
public String getZipCode(){
return zipcode;
//Set the home phone and return it
public void setHomePhone( String homeph ){
homephone = homeph;
public String getHomePhone(){
return homephone;
//Set the bday and return it
public Date getBday(){
return bday;
public void setBday(Date newBday) {
bday = newBday;
dateFormat.format(bday);
//Set the extPerson type and return it
public String getPType(){
return extPersonType;
public void setPBusiness(){
extPersonType = "Business Associate";
public void setPFamily(){
extPersonType = "Family Member";
public void setPFriend(){
extPersonType = "Friend";
public class extPerson extends Person{
//new clss People
public class People {
int MAX_PEOPLE=500;
BufferedReader bf;
public String toString() {
StringBuffer sb=new StringBuffer();
for (int i=0; i<nPeople; i++)
sb=sb.append(group[i]+"\n");
return sb.toString();
public void read(){
String str;
try {
bf=new BufferedReader(new FileReader(new File(FILE_NAME)));
str=bf.readLine();
while (str!=null) {
insert(str);
str=bf.readLine();
catch (IOException e) {
// Will jump to here on an eof condition.
try {
bf.close();
catch (IOException e) {}
public void save() {
try {
PrintWriter pw=new PrintWriter(FILE_NAME);
for (int i=0; i<nPeople; i++)
pw.println(group[i]+",");
pw.close();
catch (FileNotFoundException fne) {
System.out.println("Could not Save "+FILE_NAME);
public People() {
group=new extPerson[MAX_PEOPLE];
nPeople=0;
public boolean insert(String data) {
if (nPeople<MAX_PEOPLE) {
//extPerson guy=new extPerson(data);
//group[nPeople]=guy;
nPeople++;
return true;
else {
JOptionPane.showMessageDialog(null,"Error in People" +
"::insert: Max size reached.");
return false;
public void clear() {
// This loop frees up the memory used by each extPerson
for (int i=0; i<nPeople; i++)
group[i]=null;
nPeople=0;
extPerson group[];
int nPeople;
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
public static void createAndShowGUI(){
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Address Book Program");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = frame.getContentPane();
c.add(new AddressBook(frame));
frame.pack();
frame.setVisible(true);
public static void main (String s[]){
//Schedule a job for the event-dispatching thread:
//creating and showign this application's GUI
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();Ok, I have changed my code to reflect your suggested changes, but I'm still unsure how to use the findInLine you suggested.... This is all very new to me and I've been looking on the java website for suggestions, but I'm still stumped on how to pull this together. I'm unsure on how to set the lastname,firstname,etc. for retrieval...
Here's my code:
//ADDRESS BOOK
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.SimpleDateFormat;
import java.io.*;
import java.lang.*;
* @created September 14, 2004
* This program uses a JFrame to manipulate data and form an
* address book. The user will be able to load data from a file,
* sort it by last name, print the address, phone number, and date
* of birth, print the names of people whos birthday are between 2
* dates, print the names of people between 2 last names, and/or
* print the names of different person types.
public class AddressBook extends JPanel implements ActionListener{
JFrame frame;
final int numButtons = 7;
JRadioButton[] radioButtons = new JRadioButton[numButtons];
JButton process = new JButton("Process Request");
JLabel title;
JTextArea output = new JTextArea(30,50);
int MAX_ADDRESS_ENTRIES = 500;
AddressBookEntry addressBookEntries[] = new
AddressBookEntry[MAX_ADDRESS_ENTRIES];
public AddressBook(JFrame frame){
super(new BorderLayout());
this.frame=frame;
JPanel choicePanel = createSimpleDialogBox();
choicePanel.setBorder(BorderFactory.createTitledBorder("Choices" +
" to choose from:"));
title = new JLabel("<html><h2> Thank you for opening the " +
"Address Book. " +
"Please Press the \"Process Request\" " +
"after making a choice.</h2></html>\n",JLabel.CENTER);
title.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
output.setEditable(false);
add(title, BorderLayout.NORTH);
add(choicePanel, BorderLayout.CENTER);
add(output, BorderLayout.SOUTH);
final ButtonGroup group = new ButtonGroup();
final String saveCommand = "Save";
final String sortByLN = "Sort by Last Name";
final String searchLNCommand = "Search By Last Name";
final String printAPD = "Print address, phone number, and DOB";
final String printNamesDOB = "Print names of people whose birthday" +
" falls between 2 dates";
final String printNamesLN = "Print names of people who fall" +
" between 2 last names";
final String printPType = "Print all family members, friends, or" +
" business associates";
private JPanel createSimpleDialogBox(){
radioButtons[0] = new JRadioButton(
"<html>Save the address file</html>");
radioButtons[0].setActionCommand(saveCommand);
radioButtons[1] = new JRadioButton(
"<html>Sort the address file by last name</html>");
radioButtons[1].setActionCommand(sortByLN);
radioButtons[2] = new JRadioButton(
"<html>Search the address file by last name</html>");
radioButtons[2].setActionCommand(searchLNCommand);
radioButtons[3] = new JRadioButton(
"<html>Print the address, phone number, and DOB of a specified" +
" person</html>");
radioButtons[3].setActionCommand(printAPD);
radioButtons[4] = new JRadioButton(
"<html>Print the names of people whose birthday falls between" +
" two dates</html>");
radioButtons[4].setActionCommand(printNamesDOB);
radioButtons[5] = new JRadioButton(
"<html>Print the names of people who fall between two" +
" specified last names</html>");
radioButtons[5].setActionCommand(printNamesLN);
radioButtons[6] = new JRadioButton(
"<html>Print all family members, friends, <u>OR</u>" +
" business associates</html>");
radioButtons[6].setActionCommand(printPType);
for (int i=0; i<numButtons; i++){
group.add(radioButtons);
//set the first button (open file) to be selected
radioButtons[0].setSelected(true);
return createPane(radioButtons, process);
private JPanel createPane(JRadioButton[] radioButtons,
JButton showButton) {
int numChoices = radioButtons.length;
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
for (int i = 0; i < numChoices; i++) {
box.add(radioButtons[i]);
JPanel pane = new JPanel(new BorderLayout());
pane.add(box, BorderLayout.NORTH);
pane.add(showButton, BorderLayout.SOUTH);
return pane;
public void actionPerformed(ActionEvent e) {
String command = group.getSelection().getActionCommand();
//else if button pushed is save
if (command == saveCommand){
// save file
//else if button pushed is search by last name
else if (command == sortByLN){
// search by last name
//else if button pushed is sort by last name
else if (command == searchLNCommand){
// sort by last name
// print to screen
//else if button pushed is display address, ph#, dob
else if (command == printAPD){
// display "search by last name" dialog
// search last names
// if last name found
// print data
// else
// print error notification "person not found"
//else if button pushed is list names of people whose
//bday between 2 days
else if (command == printNamesDOB){
// ask for which dates
// search bday
// print to screen
//else if button pushed is print names of people between 2 last names
else if (command == printNamesDOB){
// ask for which two last names
// search last names
// if people found
// print to screen
//else
//print error notification "no one found"
//else if button pushed is print all family members, friends
//or business associates
else if (command == printPType){
//ask for what person type
//search person types
//if people found
//print to screen
//else print "no one found"
public class AddressBookEntry{
private extPerson address;
private String date;
private extPerson ExtPerson;
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
public static void createAndShowGUI(){
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Address Book Program");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = frame.getContentPane();
c.add(new AddressBook(frame));
frame.pack();
frame.setVisible(true);
public static void main (String s[]){
//Schedule a job for the event-dispatching thread:
//creating and showign this application's GUI
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
//PERSON
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.SimpleDateFormat;
import java.io.*;
import java.lang.*;
public class Person{
protected String lastName, firstName;
private String address;
private String city;
private String state;
private String zipcode;
private String homephone;
private String extPersonType;
private String bday;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-DD");
public void parseString(String s) {
try {
lastName = s.substring(0,s.indexOf(","));
firstName = s.substring(s.indexOf(",")+1);
address = s.substring(s.indexOf(",")+2);
city = s.substring(s.indexOf(",")+3);
state = s.substring(s.indexOf(",")+4);
zipcode = s.substring(s.indexOf(",")+5);
homephone = s.substring(s.indexOf(",")+6);
extPersonType = s.substring(s.indexOf(",")+7);
bday = s.substring(s.indexOf(",")+8);
catch(StringIndexOutOfBoundsException sbe) {
JOptionPane.showMessageDialog(null,"Error " +
"in Person: Could not parse the line "+s);
public String toString() {
return lastName+","+firstName+","+address+","+city+","+
state+","+zipcode+","+homephone+","+bday+","+extPersonType;
public void setLName(String last) {
lastName=last;
public void setFName(String first){
firstName=first;
public String getLastName() {
return lastName;
public String getFirstName() {
return lastName;
public Person() {
lastName="";
firstName="";
public Person(String first, String last){
setLName(last);
setFName(first);
//Set the address and return it
public void setAddress( String addr ){
address = addr;
public String getAddress(){
return address;
//set the city and return it
public void setCity( String town ){
city = town;
public String getCity(){
return city;
//set the state and return it
public void setState( String st )
state = st;
public String getState()
return state;
//Set the zip code and return it
public void setZipCode( String zip ){
zipcode = zip;
public String getZipCode(){
return zipcode;
//Set the home phone and return it
public void setHomePhone( String homeph ){
homephone = homeph;
public String getHomePhone(){
return homephone;
//Set the bday and return it
public String getBday(){
return bday;
public void setBday(String newBday) {
bday = newBday;
dateFormat.format(bday);
//Set the extPerson type and return it
public String getPType(){
return extPersonType;
public void setPBusiness(){
extPersonType = "Business Associate";
public void setPFamily(){
extPersonType = "Family Member";
public void setPFriend(){
extPersonType = "Friend";
public Person(String data) {
parseString(data);
//EXTPERSON
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.SimpleDateFormat;
import java.io.*;
import java.lang.*;
//new clss extPerson
public class extPerson extends Person {
int MAX_PEOPLE=500;
BufferedReader bf;
String lname,fname,street,city,state,zip,phone,persontype,bday;
String FILE_NAME="AddressBook.txt";
public String toString() {
StringBuffer sb=new StringBuffer();
for (int i=0; i<nPeople; i++)
sb=sb.append(group1[i]+"\n");
return sb.toString();
public void save() {
try {
PrintWriter pw=new PrintWriter(FILE_NAME);
for (int i=0; i<nPeople; i++)
pw.println(group1[i]+",");
pw.close();
catch (FileNotFoundException fne) {
System.out.println("Could not Save "+FILE_NAME);
public extPerson() {
group1=new extPerson[MAX_PEOPLE];
nPeople=0;
public boolean insert(String data) {
if (nPeople<MAX_PEOPLE) {
Person guy = new Person(data);
group1[nPeople]=guy;
nPeople++;
return true;
else {
JOptionPane.showMessageDialog(null,"Error in People" +
"::insert: Max size reached.");
return false;
Person group1[];
int nPeople;
Maybe you are looking for
-
No Power after Update - Mac OS X 10.4.8 Update (Intel) - HELP!!
Hi all - Brand new holiday Mac user here... i've searched, yet can't get the specifics i'm in search of... I just cracked the seal on my new Mac Book Pro 20 minutes ago... after initial set up, I got the message to download the new update... after su
-
While doing vl03n i get error balancing field profit center missing
while doing vl03n i get error balancing field profit center missing in line item 001
-
I compile forms using v6i. The forms are made with v6 and they have 2 TAB PAGES with the same block and first page is visible but the second page is not navigable with mouse. Why doesn't work ? These forms v6 are correct. Thank you.
-
Foreign Linux. Running unmodified Linux programs on Windows
So, this seems to be the opposite of WINE: https://github.com/wishstudio/flinux Foreign Linux. Right now it is pretty basic but it will be interesting to see what is further developed. The Linux image it currently runs is based on Arch. Last edited
-
Portal Favorites "Move" Command
Hi, When a user is organizing their favorites and select option "Move" they get a dialog that presents the folders in the "Entry Points" Folder. I'd like to override this move dialog so they only have visibility to their own favorites folder. Can an