Sending email from a simple JSF Form

Hi,
Sorry if this is a very basic question. I have a simple JSF (with ADF BC) form that collects information and I store the submitted values in the backing bean. I am even able to display the input values in a than you page. I just want a pointer on how I can use this data in the backing bean to email that data.
I have tried importing the JavaMail.jar and activation.jar files into my project and tried a few sample java programs I found to do this simple task. But, I am not sure I am importing the right classes to use this in a JSF program. For eg. this program right here.. not sure if the oracle.jbo.Session is the right class to import for Session.
package view.beans;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import oracle.jbo.Session;
public class javaMailer{
    public javaMailer() {
    public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException
        boolean debug = false;
         //Set the host smtp address
         Properties props = new Properties();
         props.put("mail.smtp.host", "smtp.jcom.net");
        // create some properties and get the default Session
        Session session = Session.getDefaultInstance(props, null);
        session.setDebug(debug);
        // create a message
        Message msg = new MimeMessage(session);
        // set the from and to address
        InternetAddress addressFrom = new InternetAddress(from);
        msg.setFrom(addressFrom);
        InternetAddress[] addressTo = new InternetAddress[recipients.length];
        for (int i = 0; i < recipients.length; i++)
            addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Optional : You can also set your custom headers in the Email if you Want
msg.addHeader("MyHeaderName", "myHeaderValue");
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
Thanks in advance for your time.
Edited by: Karthik on Nov 10, 2008 10:20 AM

Thanks John. Stupid me. I added the jar files to my Web-INF folder but never added the jar files to the ViewController project through the Project Properties window. Once I did that, the errors disappeared.
Thanks for your help! :-)

Similar Messages

  • Sending EMail from a simple flex2.0 form

    I have a simple form on the site I have developed. It is
    actually a component that is part of tab navigator.
    The form has fields for the user's email, what the subject is
    and the message for the body of the email.
    I do not know how to send this email and am not sure if this
    will need middle ware or not.
    The site is hosted from a coldfusion server.
    Do I use ColdFusion to send this email or is this something
    that can be done with action script and flex.mxml?
    I am looking forward towards this reply.
    Thanks,

    If you want the email to come from the user of your Flex app,
    you can do this:
    var url:URLRequest = new URLRequest(
    "mailto:[email protected]&subject="+subject.text+...);
    navigateToURL( url, "_self" );
    I don't know all of the parameters to use with mailto, but
    you should get the idea from the example (which assumes you have a
    <mx:TextInput id="subject" /> field in your form).

  • Help: how to send emails from FORMS?

    Are there simple steps to send emails from FORMS?
    Thank you in advance.
    Jimmy

    I'm sure there are many ways to send emails from Forms. Personally I never had to do this, but I can imagine following ways.
    a) use UTL_SMTP-Package to send the email via your database
    b) use a Java-Call
    Peter

  • Send Email from approval task form

    In my reusable workflow, I have added an approval action. Everything works perfectly. What I want is - When approver comes to approval form, he should be able to send notification email to the initiator (From that form) that he has started working on that document.
    What I have tried - I have added a button clicking on which will submit the form to initiator. 
    But it fails. possible reason - when I create a data connection in workflow's infopath form to submit form as email, I am getting following warning
    "Domain trust form templates cannot be sent as email attachments. to fix this problem, modify the form option to change the security level of form template to restricted".
    I also tried to update status field and wait for it to changes in workflow and send an email from sp designer workflow. it didn't work.
    Please help or suggest any other possible way to achieve this functionality (Send Email from approval task form to initiator).

    Hi mry,
    I could reproduce on my SharePoint 2013 on-premise based on your another
    post.
    Based on the the following article, SharePoint workflow cannot use the InfoPath form in restricted mode which doesn't allow the data connection, but as your image warning message shows sending InfoPath form as mail attachments will need restricted level.
    http://msdn.microsoft.com/en-us/library/office/ee526352.aspx
    You can consider to send a mail to initiator in "Whe a Task Completes" step when you click button approved/rejected, and construct the current task form link format as follow,
    http://sp/_layouts/15/WrkTaskIP.aspx?List=WorkflowTasksListGUID&ID=[%Current Task:ID%]
    Thanks
    Daniel Yang
    TechNet Community Support

  • How can i send emails from forms

    I need to be able to send emails from forms 6.(assuming the pc is running Outlook) What is the best way of doing this? Would OLE or DDE control of Outlook be the easiest method?
    If anyone has done this please let me know.

    See:
    iOS: Unable to send or receive email
    I would Google for:
    setup verizon email on phone
    for the settings to use.

  • How to sending email from Oracle 6i(Forms)

    How can I send email from Oracle Forms(6i).
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • How to sending email from Oracle Forms

    How to sending email from Oracle 6i(Forms)
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

  • TS3276 Why does my mail send an email from a different account form the one selected?

    Hi,
    I have several email accounts configured in my mail app.
    For no reason it started sending email from one of my accounts with another email address, so when people reply to my email (from a particular account) it goes to another inbox and I sometimes miss it.
    Any tips?

    In Mail>Preferences>Accounts>you can set Each Mail account to "Use Only This Server" located at the lower right of the window below, which you specify once.  Then the Mail app will not have a choice of server available to pull those shenanigans.
    Hope this helps

  • Cannot send email from an iPhone to a Outlook group.

    Hi,
    My question is simple and I'd like an exactly same answer : Can iPhone users send emails from their iPhone's to one or more groups created in Outlook?
    This is my situation: our organization is using iPhone to provide email, calendar, contact, task etc. to some of their employees. We are using Airwatch MDM Agent on user's iPhone because we have an Airwatch server in place. I have an user and she has an iPhone 5 and she has created some groups in Outlook but these groups are not reflected in her Contacts in the iPhone. I have update her phone with the latest update, although I was almost sure that this was not the issue, then I've found some interesting posts on internet saying that this was a known problem for the users with the previous iOS but I thought this might has been corrected with the iOS, apparently not.
    Also I've tried ''the trick'' that is posted on several forums with the iCloud but neither so it's working. I am looking for a straight answer, if this works or not on iPhone's?
    Thanks,
    Sebastian.

    There indeed ARE apps in the app store that will do what you want.  Just search and find the one that best fits your needs.

  • Still cannot send email from icloud .me address

    hi. does anybody knows why i cannot send email from my ipad (ios 5.0.1) icloud me.com account? i can recieve but i cannot send. on my mac (lion) it works perfectly. the message i get is "the sender address .mac.com was rejected by the server". mac.com ?? but i use my me.com address. any ideas pls?
    thank you

    I have been having the same problems for the last two days now.  It won't let me send, but it will let me save it to my drafts folder.  I even tried opening the e-mail form my iPhone 5 and it won't let me send it there either.  The last two times i ended up copying the contents from my failed e-mail on my phone and pasting that into a new e-mail and that works.  I normally use the icloud web app to reply to e-mails when i'm at work (using win 7) and it is very frustrating. 

  • Can't send email from Outlook with parentheses in address

    I can't send email from Outlook 2007 through my WRT400N when Outlook displays the address with parentheses as in this example: Firstname Lastname ([email protected])
    I can send if the address is in this form: Firstname Lastname <[email protected]>
    I have tested with the ISP and nothing gets through the router when the problem occurs. When I bypass the router, both forms of address will send correctly. This problem is perfectly reproducible. My router is brand new, but the problem did not show up for about a week after installation. OS is Win7. Any ideas? Thanks.
    -JimW
    Solved!
    Go to Solution.

    Try to forward the port 443 to 447 on the router.Check this link.

  • How do I fix Mail in Snow Leopard where I cannot send emails from my account to another account I've set up in Mail, but the reverse works fine?

    I have a problem with Mail in Snow Leopard in that I cannot set up two email accounts for myself and my wife with the same ISP and have them operate properly.  I've set up the accounts in strict accordance with my ISP's instructions for setting up email accounts on Mac Mail but I cannot send an email from my account to my wife's without a drop-down message appearing that Mail 'cannot send the email from this server.  Please edit the server list'.  No amount of tweaking appears to work.  Applecare consultants have so far been unable to get it to work and a recent visit to the local Genius Bar in the Apple Store was fruitless also.  My ISP's help line was unable to solve the problem even with a supervisor level consultant.  The ISP concluded it was some kind of 'bug' in Mail.
    I could send emails from my wife's account to mine, but not vice versa; I could send emails to other addresees without any problem and I can send emails from my account to my wife's using the ISP's webmail.
    Does anyone please have a solution to my problem?  At the moment we're operating one account (mine) on my Macbook and my wife's is set up on her iPad2.  As we prefer to use the Macbook for storage and (using Time Machine) for back-up of our data, the two accounts on separate machines is a nuisance.
    Another factor is that I prefer to control when I download emails and set my preferences accordingly.  One of the so-called 'fixes' that were tried wound up downloading emails regardless of settings, even after removing my wife's account; the matter was remedied only after I had removed all accounts form Mail and started afresh from scratch.

    You'll have to pardon my ignorance of some  computer terminology; I'm a retired manager and not a computer technician, hence my muddling up of client and server terminology.
    Re your comment about Port 339: I did qualify this with (?).  As I wrote, it all happened at lightining speed and the guy at the Genius Bar didn't bother explaining what he was doing.  Port designation contained 3s and 9s to the best of my recollection.
    That said, you seem to be spot on re setting up a 'dummy' client in Mail.  I set it up as you suggested and I can send to and receive from this client without a problem.  You appear to have identified the solution, notwithstanding the claims of the ISP's 'experts'.
    The next problem I have now is sorting out my wife's mailbox that is so troublesome whenever I set it up on Mail.
    All the other set-up advice to date yielded a similar result; inability to send from my account to her inbox.  Perhaps deleting her details from the account altogether and setting them up again from scratch may be the solution and I shall try that in due course.  The impediment that I have with this at the moment is that my ISP admits that it has 'a technical problem with its email servers' and some of its related web pages that prevent my doing this myself.  I will have to go through the telephone 'help' line and ask the technician to set it up at their end on my instructions.  This has some disadvantages in that I have to divulge the password to the account to the operator rather than keeping it anonymous by doing it on-line.   You may have solved the problem, but until I can successfully sort out a working mailbox for my wife i cannot definitively say so.
    Many thanks for your perseverance.  You've made more sense than anyone else so far and that deserves some points, surely?

  • Send email from SAP using SMTP-AUTH

    Dear all,
    I would like to send email from SAP to external SMTP server using authenticated method.
    Can I set up this scenario with SAPConnect?
    Or are there any other methods to set up this scenario?
    Thanks, Regards,
    Fendhy

    Hi,
    You dont need anu authentication to be set :
    Just follow below steps :
    Simple steps to do the SMTP configuration :
    1. Use transaction SCOT
    3. Double Click on SMTP
    4. You will get a window and fill in description
    5. Tick the "Node in use" box
    6. Enter the hostname of the email exchange server
    7. Mail port will be 25
    8. Click on the button next to Internet called "Set"
    9. You will get another window, in the "address area" box, enter *
    10. Click the green check button to exit the second window
    11. Click the green check button to exit the main window
    12. From top menu: Settings -> Default Domain
    13. in the small box that appears enter the domain name which is the last part after the @ sign. The domain name would be company.com
    14. You need to define a job to process the email, from top menu: View -> Jobs
    15. From top menu: Job -> Create
    16. Enter a name
    17. Click on "INT" in the list then "Schedule job" button
    18. Enter start date and time, then click on "Schedule Periodically" button
    19. Enter something like every 10 minutes.
    20. the configuration is now complete. To test it, you need to have an email defined in your user id properties. Use SU01 for that.
    21. Use transaction SO00
    22. Put Title, and text in the body, then enter your email address below, the recepient type would be "internet address"
    23. After a maximum of 10 minutes you should get the email address.
    Regards,
    Nirmal.K

  • Can not send email from .mac account from the iPhone

    I'm having problems sending email from my iPhone from my .Mac Account and says the outgoing server timed out. Any Suggestions?

    This error message indicates you are not using the correct server port for .Mac's SMTP server.
    Did you transfer the account settings from your Mac to the iPhone automatically via the iTunes sync process or did you manually create your .Mac account on the iPhone?
    If the former, go to Mail > Preferences > Accounts and under the Account Information tab for your .Mac account preferences at the SMTP Server selection, select the Server Settings button below for .Mac's SMTP server.
    If 25 is available in the Server Port field, enter 587 in place of 25 and when finished, select OK to save the changed setting and then re-sync your iPhone making sure your .Mac account is selected for account settings to be transferred to the iPhone.

  • Why can I no longer send email from my Hotmail SMTP account using Mail?

    I can no longer send email from my Hotmail SMTP account using Mail. The connection doctor says it can't connect to the SMTP server. All the settings look to be correct and it was working fine before. I can still email using my iPhone with the same account.

    Other may post it is some type of change with your ISP but the simple fact is this happen with Apple Mac Mail all the time.
    IMHO Mac Mail is one of, if not the, worst mail program ever written.
    Do yourself a big favor and start using some other mail program, any other Mail program.

Maybe you are looking for

  • ICloud/Apple ID authentication mistery

    Short question is. Why does the AFP connection to my Mac-Lion bypass the password when connecting from another Mac signed in iCloud? Here are some details. 1. The Mac-Lion is off-cloud and I reset the keychain many times. 2. I am connecting from the

  • Can not update pricing in ME22N

    I have created PO which is having pricing procedure consisting different condition type. When i create any subsequent document (MIGO or MIRO) and realized that condition value in the pricing need to be changed so I have reversed all subsequent docume

  • ITunes 8.2.1.6 will not play most of the songs in my library

    Since downloading iTunes 8.2.1.6 most of the songs in my library will not play on my computer. I am afraid to update my iPod for that reason. It is not album specific or iTunes purchased/cd ripped/ or internet downloaded specific either. Has affected

  • Startup disk question/problem

    Should the startup disk always be at the top of the list of disks upon startup? Or is it now the case, with 10.5 on a MacBook, that the internal disk is at the top of the list whether or not it is the startup disk? Situation: New MacBook Mac OS 10.5.

  • What is the include for text variable?

    Dear Friends I am trying to add a customer exit for text variables. I have done variable exits for things like fiscal period but not for customer exit TEXT variables. I could not find any text variable code in the include ZXRSRU01  . Please advise wh