Sending email using UTL_SMTP

Dear experts,
I am trying to send an email using UTL_SMTP (i switched from UTL_MAIL to UTL_SMTP since i need to send mails with large attachments - BLOB). I am using the demo_mail package given here:
http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
While running the program I am getting an error message (from the error.log) saying:
[Mon Aug 04 14:00:21 2008] [error] [client 192.168.0.7] mod_plsql: /ns/email_p.send HTTP-404 ORA-29279: SMTP permanent error: 530 5.7.0 Must issue a STARTTLS command first. 9sm12723808qbw.6\nORA-06512: at "SYS.UTL_SMTP", line 20\nORA-06512: at "SYS.UTL_SMTP", line 98\nORA-06512: at "SYS.UTL_SMTP", line 221\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 258\nORA-06512: at "NEXTSTEP.SEND_EMAIL_HELPER", line 119\nORA-06512: at "NEXTSTEP.EMAIL_P", line 33\nORA-06512: at line 31\n, referer: file:///C:/Documents and Settings/Mayank/My Documents/Flex Builder 3/ns5/bin-debug/main.swf
My code is as follows:
PACKAGE DECLARATION. This is the DEMO_MAIL package posted under above link (I have renamed it).
CREATE OR REPLACE PACKAGE NEXTSTEP.send_email_helper IS
  ----------------------- Customizable Section -----------------------
  -- Customize the SMTP host, port and your domain name below.
    smtp_host   VARCHAR2(256) := 'smtp.gmail.com';
    smtp_port   PLS_INTEGER   := 587;
    smtp_domain VARCHAR2(256) := null;
  -- Customize the signature that will appear in the email's MIME header.
  -- Useful for versioning.
  MAILER_ID   CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
  --------------------- End Customizable Section ---------------------
  -- A unique string that demarcates boundaries of parts in a multi-part email
  -- The string should not appear inside the body of any part of the email.
  -- Customize this if needed or generate this randomly dynamically.
  BOUNDARY        CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
  FIRST_BOUNDARY  CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
  LAST_BOUNDARY   CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
                                              utl_tcp.CRLF;
  -- A MIME type that denotes multi-part email (MIME) messages.
  MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
                                                  BOUNDARY || '"';
  MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER   := 76 / 4 * 3;
  -- A simple email API for sending email in plain text in a single call.
  -- The format of an email address is one of these:
  --   someone@some-domain
  --   "Someone at some domain" <someone@some-domain>
  --   Someone at some domain <someone@some-domain>
  -- The recipients is a list of email addresses  separated by
  -- either a "," or a ";"
  PROCEDURE mail(sender     IN VARCHAR2,
         recipients IN VARCHAR2,
         subject    IN VARCHAR2,
         message    IN VARCHAR2);
  -- Extended email API to send email in HTML or plain text with no size limit.
  -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
  -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
  -- email in non-ASCII or multi-byte character set. End the email with
  -- end_mail().
  FUNCTION begin_mail(sender     IN VARCHAR2,
              recipients IN VARCHAR2,
              subject    IN VARCHAR2,
              mime_type  IN VARCHAR2    DEFAULT 'text/plain',
              priority   IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
  -- Write email body in ASCII
  PROCEDURE write_text(conn    IN OUT NOCOPY utl_smtp.connection,
               message IN VARCHAR2);
  -- Write email body in non-ASCII (including multi-byte). The email body
  -- will be sent in the database character set.
  PROCEDURE write_mb_text(conn    IN OUT NOCOPY utl_smtp.connection,
              message IN            VARCHAR2);
  -- Write email body in binary
  PROCEDURE write_raw(conn    IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
  -- APIs to send email with attachments. Attachments are sent by sending
  -- emails in "multipart/mixed" MIME format. Specify that MIME format when
  -- beginning an email with begin_mail().
  -- Send a single text attachment.
  PROCEDURE attach_text(conn         IN OUT NOCOPY utl_smtp.connection,
            data         IN VARCHAR2,
            mime_type    IN VARCHAR2 DEFAULT 'text/plain',
            inline       IN BOOLEAN  DEFAULT TRUE,
            filename     IN VARCHAR2 DEFAULT NULL,
                last         IN BOOLEAN  DEFAULT FALSE);
  -- Send a binary attachment. The attachment will be encoded in Base-64
  -- encoding format.
  PROCEDURE attach_base64(conn         IN OUT NOCOPY utl_smtp.connection,
              data         IN RAW,
              mime_type    IN VARCHAR2 DEFAULT 'application/octet',
              inline       IN BOOLEAN  DEFAULT TRUE,
              filename     IN VARCHAR2 DEFAULT NULL,
              last         IN BOOLEAN  DEFAULT FALSE);
  -- Send an attachment with no size limit. First, begin the attachment
  -- with begin_attachment(). Then, call write_text repeatedly to send
  -- the attachment piece-by-piece. If the attachment is text-based but
  -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
  -- To send binary attachment, the binary content should first be
  -- encoded in Base-64 encoding format using the demo package for 8i,
  -- or the native one in 9i. End the attachment with end_attachment.
  PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                 mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                 inline       IN BOOLEAN  DEFAULT TRUE,
                 filename     IN VARCHAR2 DEFAULT NULL,
                 transfer_enc IN VARCHAR2 DEFAULT NULL);
  -- End the attachment.
  PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
               last IN BOOLEAN DEFAULT FALSE);
  -- End the email.
  PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
  -- Extended email API to send multiple emails in a session for better
  -- performance. First, begin an email session with begin_session.
  -- Then, begin each email with a session by calling begin_mail_in_session
  -- instead of begin_mail. End the email with end_mail_in_session instead
  -- of end_mail. End the email session by end_session.
  FUNCTION begin_session RETURN utl_smtp.connection;
  -- Begin an email in a session.
  PROCEDURE begin_mail_in_session(conn       IN OUT NOCOPY utl_smtp.connection,
                  sender     IN VARCHAR2,
                  recipients IN VARCHAR2,
                  subject    IN VARCHAR2,
                  mime_type  IN VARCHAR2  DEFAULT 'text/plain',
                  priority   IN PLS_INTEGER DEFAULT NULL);
  -- End an email in a session.
  PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
  -- End an email session.
  PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
END;How should I solve the above error? Can anyone help me with my query please?
If I add the code to start TLS it still gives me an error. If I add the code
utl_smtp.command(conn,'STARTTLS');
utl_smtp.helo(conn, smtp_domain);
under email_sender_help package just before under begin_session function, it gives me an error saying:
ORA-29279: SMTP permanent error: 503 5.5.1 EHLO/HELO first. s27sm2097329qbs.12
So then if i enter the same code after:
utl_smtp.command(conn,'STARTTLS');
utl_smtp.helo(conn, smtp_domain);
It gives me an error:
ORA-29278: SMTP transient error: 421 Service not available
Message was edited by:
Monk
Message was edited by:
Monk

look like rely turned off on the server..
check this.. or ask your network guys..
Go to Control Panel->Add or Remove Programs->Click on
Add/Remove Wndows Components
Check IIS check box.
Select Internet Information Service (IIS) option and click on Details button
Check whether SMTP Service is checked or not.
If not selected then select SMTP check box.
This process should be done on server.
It will help out from ORA-29278: SMTP transient error: 421 Service not available problem.
thanks

Similar Messages

  • Sending html email using utl_smtp

    (Oracle 8.1.7)
    I'm using the following procedure to send an HTML formatted e-mail. It sends email but I'm seeing in Outlook html code instead of formatted mail. (It sends text like :
    a bit of text
    --a1b2c3d4e3f2g1
    content-type: text/html;
    <html><head></head><body><B>HELLO </B></body></html>
    a1b2c3d4e3f2g1
    What can I solve this problem?
    Thanks in advance...
    its usage :
    html_email('smo@....','smo2@...','This is a subject','a bit of text', '<html><head></head><body><B>HELLO </B></body></html>', 'some hostname',25);
    CREATE OR REPLACE procedure html_email(
    p_to in varchar2,
    p_from in varchar2,
    p_subject in varchar2,
    p_text in varchar2 default null,
    p_html in varchar2 default null,
    p_smtp_hostname in varchar2,
    p_smtp_portnum in varchar2)
    is
    l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
    l_connection utl_smtp.connection;
    l_body_html clob := empty_clob; --This LOB will be the email message
    l_offset number;
    l_ammount number;
    l_temp varchar2(32767) default null;
    begin
    l_connection := utl_smtp.open_connection( p_smtp_hostname, p_smtp_portnum );
    utl_smtp.helo( l_connection, p_smtp_hostname );
    utl_smtp.mail( l_connection, p_from );
    utl_smtp.rcpt( l_connection, p_to );
    l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
    l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
    l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
    l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
    l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
    l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
    chr(34) || l_boundary || chr(34) || chr(13) ||
    chr(10);
    -- Write the headers
    dbms_lob.createtemporary( l_body_html, false, 10 );
    dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
    -- Write the text boundary
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    l_temp := '--' || l_boundary || chr(13)||chr(10);
    l_temp := l_temp || 'content-type: text/plain; charset=us-ascii' ||
    chr(13) || chr(10) || chr(13) || chr(10);
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Write the plain text portion of the email
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
    -- Write the HTML boundary
    l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
    chr(13) || chr(10);
    l_temp := l_temp || 'content-type: text/html;' ||
    chr(13) || chr(10) || chr(13) || chr(10);
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Write the HTML portion of the message
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
    -- Write the final html boundary
    l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
    l_offset := dbms_lob.getlength(l_body_html) + 1;
    dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
    -- Send the email in 1900 byte chunks to UTL_SMTP
    l_offset := 1;
    l_ammount := 1900;
    utl_smtp.open_data(l_connection);
    while l_offset < dbms_lob.getlength(l_body_html) loop
    utl_smtp.write_data(l_connection,
    dbms_lob.substr(l_body_html,l_ammount,l_offset));
    l_offset := l_offset + l_ammount ;
    l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
    end loop;
    utl_smtp.close_data(l_connection);
    utl_smtp.quit( l_connection );
    dbms_lob.freetemporary(l_body_html);
    end;

    There have been many very good threads on sending email using the UTL_SMTP on the forum including threads that deal with HTML formated mail.
    The basic process is to the same as with sending regular (non HTML) mail, but you add some additional headers to the mail message as well as additional formatting to the message body (e.g. HTML tags as needed).
    Specifically you need to add the two following headers:
    MIME-Version: 1.0
    Content-type: text/html

  • How to format and send html email using utl_smtp

    Hi,
    I need to send email in the html format from within the database using utl_smtp. I am really not interested in creating os level file using "set markup html on spool on" and sending that as an html attachment. Can someone please give a code?
    1. Output of a select needs to be emailed (for example : select empid, name from emp, salary)
    2. Certian cells for example salary < 4800 needs to be higlighted in Red color
    3. I need to send email which is having more than 32767 characters (I can not use varchar2 field)
    I have reffered to following url on asktom:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1739411218448
    However it does not help.
    If someone has a sample code with any select from a table, it would be a great help.
    Regards
    Sudhanshu Bhandari

    There have been many very good threads on sending email using the UTL_SMTP on the forum including threads that deal with HTML formated mail.
    The basic process is to the same as with sending regular (non HTML) mail, but you add some additional headers to the mail message as well as additional formatting to the message body (e.g. HTML tags as needed).
    Specifically you need to add the two following headers:
    MIME-Version: 1.0
    Content-type: text/html

  • Loss of sending email using WIFI

    As of this morning 8-20-08, after updating to 2.02, I no longer am able to send emails using my own wireless network. Previously this was no problem. Neither Fido or Apple have any idea of what I am talking about. Fido washed their hands as they do not support WIFI. How convenient, they sell the phone and charge for the service but do not support it. Videotron, my ISP, thinks the issue is my wireless router but I can send via gmail so that's out. I resovled the problem by configuring my accounts to use my gmail smtp server as a second option and now the spinning wheel is short lived and messages are sent.
    I'm sorry to say that I had fallen for all the hype about Apple but truth is they are but a Microsoft wannabe.
    Disinchanted

    So here's the wierd thing.
    I was having the same problems. Set up SMTP for Videotron when at home using relais.videotron.ca SMTP with no authenticationon port 25 & all was good in the world. However when I went out, bang. Nothing. Couldn't send a mail for love nor money.
    Thought aboutit & changed settings to use relais.videotron.ca SMTP, but this time using authentication of vltl** / password credentials with no SSL (Videotron doesn't use SSL) and again everything was fine. Of course, when I got home again, bang. Everything fell over & no more mail sending foe me!
    So I figure, when I'm at home I'm on my trusted network at port 25, I don't need authentication and all is good, but when I'm out i'm seen as potential SPAM by port 25 on videotron & get blocked.
    Tried using port 587 instead when for both home & mobile but had no luck either.
    Then a strange thing happened. I'd resolved to having to set up 2 SMTP servers on my iPhone & switching between the two based on where I was. Pain in the a**, but there's always a trade off for early adopter technology So I set up my primary SMTP to use port 25 with no authentication, and a secondary server to use the same relais.videotron.ca outgoing server, but this time WITH authentication using vltl** \ password credentials.
    After a walk to the shop when I'd been on my secondary SMTP server (successfully sending & recieving) I came home & inadvertantly forgot to swith back to my primary SMTP. Recieved a mail & then responded with no problem!
    Net result, I now have a permanently switced off primary server & a permanently switched on secondary server which uses relais.videotron.ca details with vltl** \ password authentication credentials active (like I did on my old silver iPhone) & all is good in the world, both at home & out mobile, both for sending & recieving!
    Will field test some more tomorrow but it may be a 2.0.2 bug where ther primary server details fcuk up whereas the secondary server details are stable.
    So long as it works, who cares!
    Jof

  • How can I send email using two different email address that both link back to my one exchange account on my Ipad mini

    How can I send email using two different email address that both link back to my one exchange account on my Ipad mini? 
    On my PC I simply have a master return email address and use a POP for the secondary address.  Both are through the one exchange account without a problem.  I need to be able to do the same on my Ipad.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • IPhone cannot send email using Yahoo account. iPhone no envia correo Yahoo.

    Hi Everyone,
    I just got my iPhone from Movistar Venezuela and I've found I'm unable to send email using my Yahoo account. However, I can receive Yahoo email just fine (paid $20 for Mail Plus subscription), my GMail account can send and receive perfectly, and I can go surfin' Safari with no problems too.
    The error message I get is "Cannot send mail: an error occurred while delivering this message". I called Movistar Customer Support and they said everything was fine on their end...
    In typical Apple fashion, the error message is so simple I have no idea where the problem is. Does anyone know how can I get more information and how to solve this annoying problem? My Yahoo account is actually my primary account...
    Thanks in advance!
    Saludos a todos,
    Acabo de comprarme un iPhone de Movistar en Venezuela y me encuentro sin poder enviar emails con mi cuenta Yahoo. Sin embargo, si puedo recibir correo Yahoo bien (pague $20 por mi suscripcion a Mail Plus), mi cuenta de GMail si puede enviar y recibir email sin problema y puedo navergar con Safari sin ningun problema.
    El mensaje de error que recibo es el siguiente": "No se puede enviar correo: se ha producido un error al enviar el mensaje". Llame a Atencion al Cliente de Movistar y me dijeron que no habia ningun problema con mi linea o con su servicio de datos...
    Como tipica cosa Apple, el mensaje de error es tan simple que no tengo NI IDEA de cual es el problema. Alguien mas ha sufrido este problema? Sabe alguien como puedo obtener mas informacion de este error y como solucionarlo? Lamentablemente, mi cuenta Yahoo es mi correo principal...
    Gracias de antemano!

    Creo que resolvi el problema, temporalmente.
    1) Borra tu cuenta
    2) Vuelvela a crear
    3) Ve a Ajustes
    4) Ve a Mail Contactos Calendarios
    5) Ve a la cuenta problematica
    6) Ve a SMTP
    7) Anadir nuevo
    8)
    Nombre servidor: smtp.mail.yahoo.com
    Nombre de usuario: no dejar vacio
    Contrasena: no dejar vacio
    Usar SSL: si
    Autenticacion: Contrasena
    Puerto del Servidor: 25
    Lo consegui de aqui: http://www.emailaddressmanager.com/tips/mail-settings.html
    Dime que tal te funciona.
    I think I solved the issue, temporarily at least
    1) Delete account
    2) Create again
    3) Go to settings
    4) Go to Mail, Contacts, Calendars
    5) Open problematic account
    6) Go to SMTP
    7) Add a new server
    8)
    Name: smtp.mail.yahoo.com
    User name: do not leave blank
    Password: do not leave blank
    SSL: Yes
    Autentication: Password
    Port: 25
    I got this info from: http://www.emailaddressmanager.com/tips/mail-settings.html
    Let me know how this works

  • TS3899 issues sending email using my gmail account on my new iphone4s.

    so i was having issues sending email using my gmail account on my new iphone4s.  i called my provider, att - to fix the issue, mine anyway, under settings - general - reset - reset network connections.  fixes the send issue.  releases all of the other junk that was left on your old phone. 

    Hi Jari,
    Thanks to reply me.
    There is an workspace details where user solve that problem but now i have troed to access that workspace but its not working .i have cofusion how can i do this where i put
    apex_mail.send(
    p_to => v_recipient_list
    , p_from => v_from_list
    , p_subj => 'Hello world'
    , p_body => v_body
    , p_replyto => null);
    this package
    and how to and where set SMTP of Gmail and i don't know about gmail SMTP Server Specification
    i ahve jus create a form with
    P1_TO Text Field
    P1_SUBJECT Text Field
    P1_FILE_BRE File Browse...
    P1_COMMENT Textarea
    Please guid me...how can i do that step by step
    Thanks

  • Sending email using IMAP through SMTP Port 587

    Hi,
    I have been sending Mail Merged email to people in organizations that I am active in, using IMAP embedded in StarOffice 5.2 (on Windows 98 Second Edition). This worked fine until a few weeks ago when I received an error message stating that AOL, as part of their anti-spam efforts, was no longer accepting third-party emails on default port 25. All third-party email must now use port 587. I looked in the IMAP dialog and in the Tools -> Options dialog, but did not see any place to change the SMTP port. The AOL error message information page had instructions for changing the port in other applications (Outlook, Eudora, etc.), but not for StarOffice. So, I have some questions:
    1.Is it possible to change the port in StarOffice 5.2?
    2.If not, how does StarOffice 8 send Mail Merged email? Does it use IMAP, and if so, can the port be changed?
    3.Also, I like the integrated configuration in StarOffice 5.2, where database fields can be directly accessed in the Insert -> Fields -> Other dialog. In looking at the Mail Merge section in "SO8_What's New.pdf", it appears that Mail Merge in StarOffice 8 is restricted to predefined fields. Could I still access fields from my existing databases?
    These is a lot of questions, but right now I am blocked from sending Mail Merged emails which is imparing communications with volunteers who are running educational programs. I appreciate any and all help that anyone can provide.

    Please try this out!!!!!!!!!
    You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
    Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
    'Create an Outlook object
    Dim Outlook 'As New Outlook.Application
    Set Outlook = CreateObject("Outlook.Application")
    'Create e new message
    Dim Message 'As Outlook.MailItem
    Set Message = Outlook.CreateItem(olMailItem)
    With Message
    'You can display the message To debug And see state
    '.Display
    .Subject = Subject
    .Body = TextBody
    'Set destination email address
    .Recipients.Add (aTo)
    'Set sender address If specified.
    Const olOriginator = 0
    If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
    'Send the message
    .Send
    End With
    End Sub

  • Does any one have a sample code for sending email using IMAP ?

    Hi
    thank you for reading my post
    I have tried to use SMTP and because of some problems i could not use it and i must use Imap (authentication required)
    here is my SMTP code , does any one know how i can tune it to use Imap , or has a code snippet to send email using Imap ?
    thanks
    private static void postMail(String[] recipients, String subject, String message,
                             String from) throws MessagingException {
            boolean debug = false;
            class SMTPAuthenticator extends javax.mail.Authenticator
                    public PasswordAuthentication getPasswordAuthentication()
                        return new PasswordAuthentication(mail_usrname,mail_password);
            //Set the host smtp address
            Properties props = new Properties();
            FileInputStream fis;
            try {
                System.out.println("Loading property file");
                fis = new FileInputStream(new File("c:/email.properties"));
                props.load(fis);
                System.out.println("property file done");
            } catch (FileNotFoundException e) {
                System.out.println("file not found");
                e.printStackTrace();
            } catch (IOException e) {
                System.out.println("can not read properties file");
                e.printStackTrace();
            /*props.put("mail.smtp.user", mail_usrname);
    props.put("mail.smtp.host", smtpHost);
    props.put("mail.smtp.port", smtpPort);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.socketFactory.port", smtpPort);
            // create some properties and get the default Session
            Authenticator auth = new SMTPAuthenticator();
            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);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/HTML");
    System.out.println(msg.toString());
    Transport.send(msg);

    Please try this out!!!!!!!!!
    You can send emails using Outlook also. You can send email over Microsoft Exchange with this object (or another email server, using IMAP/POP).
    Sub SendMailOutlook(aTo, Subject, TextBody, aFrom)
    'Create an Outlook object
    Dim Outlook 'As New Outlook.Application
    Set Outlook = CreateObject("Outlook.Application")
    'Create e new message
    Dim Message 'As Outlook.MailItem
    Set Message = Outlook.CreateItem(olMailItem)
    With Message
    'You can display the message To debug And see state
    '.Display
    .Subject = Subject
    .Body = TextBody
    'Set destination email address
    .Recipients.Add (aTo)
    'Set sender address If specified.
    Const olOriginator = 0
    If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
    'Send the message
    .Send
    End With
    End Sub

  • 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.

  • When I send emails using my iPad, recipients are telling me that I am sending them blank emails.  I've had some of them forward the emails back to me so I can take a look and it seems that my message is actually there but the text is white...

    When I send emails using my iPad, some recipients are telling me that I am sending them blank emails.  I've had some of them forward the emails back to me so I can take a look and it seems that my message is actually there but the text is white.  Interestingly enough, I was a Windows user just a few months ago and I was on the receiving end of this same problem with someone who was sending emails from her iPhone.  I don't believe it is happening every time but if it happens even once it's a problem.  Any idea what's going on? 

    Oddly enough, having reported the problem it appears to have fixed itself. There may be some combination swipe gesture that triggers it is all I can think because I suddenly manged to zoom my display x3 by double tapping three fingers. Took me a while to sort this out but then when I got back home I could suddenly see all my emails again. Bizarre!

  • I am unable to send emails using iCloud, but am receiving.

    I am unable to send emails using iCloud from both my laptop and my ipad.  I am paying for 25Gb of storage and am only using 3Gb at the moment.  I get the following message " Your email has been placed in the Outbox as you have exceeded your limit for sending emails".  I have not sent any emails today at all!

    http://support.apple.com/kb/ht4863
    Or contact Apple:  https://getsupport.apple.com

  • Problem with Thunderbird email: When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others rece

    Problem with Thunderbird email:
    When I send email using a mailing list, with my email included in the list, the message shows up in my Sent list and others receive it but it does not come to my email Inbox. The same problem occurs when I send the email to the mailing list addresses individually. When I send a simple test message to myself, I do receive it in my Inbox. Can you help me??
    Bob Greenman

    Are you using either cc or bcc? Is googlemail involved? Some email providers suppress cc's and bcc's to oneself since you will have a copy in your Sent folder.

  • Javascript error when send email using webmail

    Dear Sun,
    One of our user encounter javascript error when try sending email using webmail below is the error message:
    " +https://webmail.ubd.edu.bn/uwc/webmail/comp_fs_lr.html&rev=3&security=false&lang=en&popupLevel=undefined&cal=1&charset=escaped_unicode, Line 1755+
    +Permission denied+
    "

    Hi Shane,
    below is the answer you need
    What browser is the user using?
    => Firefox and IE
    What browsers have you tested where it doesn't occur?
    =>I tested all the browser (firefox,IE, chrome) it doesn't happen to me
    When did this problem first start?
    =>After the user finish compiled his message and click send
    What is the exact version of UWC you are running (./showrev -p | grep uwc)
    =>Patch: 122793-26 Obsoletes: 118540-43, 117287-99, 117819-13, 119156-07 Requires: Incompatibles: 118042-22, 126233-04 Packages: SUNWuwc
    Patch: 122793-29 Obsoletes: 118540-43, 117287-99, 117819-13, 119156-07 Requires: Incompatibles: 118042-22, 126233-04 Packages: SUNWuwc
    Patch: 122793-31 Obsoletes: 118540-43, 117287-99, 117819-13, 119156-07 Requires: Incompatibles: 118042-22, 126233-04 Packages: SUNWuwc
    Does this error occur all the time? Does it occur for every user, or some users or just one user?
    => Not all the time, so far i just receive one complaint .

  • I am unable to send emails using mail from my btinternet and yahoo accounts similar problem to others with mobile me accounts on lion any suggestions?

    I am unable to send emails using mail from my btinternet and yahoo accounts similar problem to others with mobile me accounts on lion any suggestions?

    Do I need to delete all my email accounts and start again?

Maybe you are looking for

  • Random freeze ups.  Must reboot each time.

    Random full screen lock with no errors reported using the hardware test disc. Mouse can move on screen (arrow or beach ball) but no clicks or key presses of any kind cause a response. The clock freezes instantly as does video playback. Audio dies alt

  • How to calculate percentage based on key figure maximum value

    Hello everybody! I need your expertise on a query 'issue' I'm facing. Let's say I have a query getting me the Number of Open Items per Week (starting from billing document's Issue Date). My client wants to be able to see the percentage per week and n

  • Toshiba LCD 46G310U display goes dark

    I have a Toshiba 46" LCD model: 46G310U that when first plugged up has a perfect picture on all inputs. However after a few seconds to a few minutes the display goes dark with a horizontal line across the screen about half way down. The horizontal li

  • How to rename podcasts in store?

    So 3rd time was a charm and iTune Store accepted my podcast, however when resubmitting my RSS feed I had to rename it. I was told at the time I could rename it after it was accepted. I am not sure where to do this. I prepared the RSS Feed in the Mac

  • Passwords won't fill

    I've been using firefox for years. Recently passwords stopped auto filling in webpages I have them saved on. The passwords are still in firefox, they just don't auto fill.