501 Command "HELO" requires an argument

I repost this message, since I keep getting the same problem.
Keep getting the following error message while trying to run the code I've cut & pasted below on IBM AS400 machine. Can anybody help
javax.mail.MessagingException: 501 Command "HELO" requires an argument
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class xxJMail {
public static void main(String[] args) {
if (args.length < 4) {
System.out.println("usage: java xxJMail <to> <from> <subject> <message> <file>");
System.exit(1);
String to = args[0];
String from = args[1];
String subject = args[2];
String message = args[3];
String host = "BLY1-SMTP1";
String filename = null;
MimeBodyPart mbp1 = new MimeBodyPart();
MimeBodyPart mbp2 = new MimeBodyPart();
if ( args.length > 4)
{filename = args[4];}
// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);
try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
mbp1.setText(message);
// if file name pass as argument attach the file to the message
if( filename != null)
{ FileDataSource fds = new FileDataSource(filename);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
if( filename != null)
{ mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
// set the Date: header
msg.setSentDate(new Date());
// send the message
Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}

Helo.
I had the same problems and it can be solved this way :
Your code was :
// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Yo should add
props.put("mail.smtp.localhost", smtpServerName);
For example, you want to send an email using a smtp server called "toto" and you get the follwing error :
class javax.mail.MessagingException: 501 Syntax: HELO hostname
' just add :
props.put("mail.smtp.localhost", "toto");
And now it should works fine.
Hope it helps.

Similar Messages

  • 501 HELO requires domain address

    I have deployed my web application in sun java system application server 8.1 running on solarix box. The email functionality is not working and comes back with the following message.
    501 HELO requires domain address
    javax.mail.MessagingException: 501 HELO requires domain address
    at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1250)
    at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:774)
    The web application works perfectly fine in netbeans4.1 integrated with sun AS 8.1 server on windows platform.
    How do I resolve this issue?
    Thanks.

    Before the error occurs can you output the result of:
    InetAddress.getLocalHost().getHostName()This is what is passed with the HELO and it sounds like it is messed up.

  • I am getting this error :The right function requires 2 argument(s).

    declare 
    @startdate datetime,
    @enddate datetime 
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '01-MAR-2014'
    Set @StartDate = Convert(datetime, Convert(char(10), @StartDate, 120) + ' 00:00:00', 120)
    set @enddate =convert(datetime,Convert(char(10),@enddate, 120) + ' 23:59:59',120) 
    SELECT 
    [row_date]
    ,[logid]
    ,CONVERT(VARCHAR(6), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0))/3600) + 
    ':' + RIGHT('0' + CONVERT(varchar(2),(ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 3600) / 60), 2)
    + ':' + RIGHT('0' + CONVERT(varchar(2), (ISNULL(SUM([acwouttime] + [auxouttime] + [holdtime]), 0)) % 60), 2)AS HoldTime
    FROM [CMSData].[dbo].[hagent2]
    WHERE ([logid] IN (1382, 1493,1382,1493,1444,1466,1301,1074,1655,
    1749,1685,1686,1684,1617,1681,1792,1595,1597,1687,1622))
    AND (row_date BETWEEN  @StartDate AND @EndDate)
    GROUP BY 
    [row_date]
    ,[logid]
    hi friends when I am executing this query I am getting this error please help me I will grateful to you .
    ERROR: The right function requires 2 argument(s).

    you may be better off making date filter as below
    declare
    @startdate datetime,
    @enddate datetime
    SET @STARTDATE ='01-MAR-2014'
    SET @enddate = '02-MAR-2014'
    AND (row_date >= @StartDate AND row_date <@EndDate)
    see
    http://visakhm.blogspot.in/2012/12/different-ways-to-implement-date-range.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • MessagingException: 501 Syntax: HELO hostname. Very Urgent

    Hi,
    I am getting an error message : "MessagingException: 501 Syntax: HELO hostname" when trying to send mail using Java Mail API. Can anyone plz help me. It's very urgent. I am using this code. I had using the host name as my mail server name.
    try
         String host = "smtp.xxxxx.com";
              String from = "[email protected]";
              String to="[email protected]";
              String htmlText=null;
              to = fremail;
         Properties props = System.getProperties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.starttls.enable", "true");
    Session session1 = Session.getDefaultInstance(props, null);
         MimeMessage message = new MimeMessage(session1);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject("Hai. Mail send using Java Mail");
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setContent(htmlText, "text/html");
    MimeMultipart multipart = new MimeMultipart("related");
    multipart.addBodyPart(messageBodyPart);
    message.setContent(multipart);          
    Transport.send(message);
    catch (Exception e)
    out.print("Exception is" +e);
    Plz help me.
    Thanks in advance.

    Hi,
    I had already set the HOST Name using
    String host="smtp.mymailserver.com";
    props.put("mail.smtp.host", host);
    Then also it is giving error. Plz help me and tell me wew i am doing wrong. It's very urgent. Hoping early positive response from u.
    Regards,
    Devom

  • The sum function requires 1 argument(s).

    ---Hi i am trying get all of
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    and for each emp_name?
    but it is not wotking for me. the error says: The sum function requires 1 argument(s).
    what shoould i change on the code below so mY Query can Run?
    thank you
    B.
    select distinct
    G.Emp_name,
    upper(G.EMP_case_number) as MIS_EMP_case_NO,
    G.Emp_name as Emp,
    G.MIS_Emp_id,Radius,
    G.address,
    G.DC as Emp_DC,
    G.Emp_class,
    Q.YEAR,
    Q.EMP_case_number,
    (sum(Q.SCTOTAL,0)) as SC,
    (sum(Q.SRTOTAL,0)) as SRTOTAL,
    (sum(Q.CminusREF,0))as CminusREF,
    (sum(Q.SFAT,0))as SFAT,
    (sum(Q.SPAT,0))as SPAT,
    (sum(Q.SNOTATPT,0))as SNOTATPT,
    (sum(Q.SET,0))as SET,
    (sum(Q.TOTAV,0))as TOTAV
    FROM tbl_MIS_QC G
    LEFT JOIN QCPFA Q ----View
    ON upper(Q.EMP_case_number) = upper(G.EMP_case_number)
    where DC = '55'
    gorup by G.Emp_name
    order by G.Emp_name, upper(G.EMP_case_number)

    Hi,
    It's true: the SUM function only takes one argument. What are you trying to do with the second argument, 0?
    When you use aggregate functions (like SUM), everything in the SELECT clause must be an aggregate function, a constant, or one of the GROUP BY columns. Without knowing your tables, your data, or what results you want, I can't tell you exactly what to do. You might want to compute the SUMs in a sub-query before joining them to the other table, something like this:
    select  G.Emp_name,
            upper(G.EMP_case_number) as MIS_EMP_case_NO,
            G.Emp_name as Emp,
            G.MIS_Emp_id,Radius,
            G.address,
            G.DC as Emp_DC,
            G.Emp_class,
            Q.YEAR,
            Q.upper_EMP_case_number,
            q.sc,
            q.srtotal,
    FROM    tbl_MIS_QC G
    LEFT JOIN
            (   -- Begin in-line view q
            SELECT  year,
                    UPPER (emp_case_number) AS upper_emp_case_number,
                    sum(SCTOTAL) as SC,
                    sum(SRTOTAL) as SRTOTAL,
            FROM    QCPFA
            GROUP BY  year,
                      UPPER (emp_case_number)
            )   -- End in-line view q
    ON Q.upper_EMP_case_number = upper(G.EMP_case_number)
    where DC = '55'
    order by G.Emp_name, upper(G.EMP_case_number) Repeat: this is just a wild guess, the best I can do without seeing some test data and the results you want from that data.

  • Repairing AME - dos command info required

    dos command info required
    Repairing AME which got damaged in CS3 after installing CS4
    "Failed to initialise error".
    Repair advice was to run (from the Command Prompt) the following. WMEncodingHelper.exe/regserver
    It is found in C:\Program Files\Adobe\Adobe Premiere CS3\
    I can get to the directory line and see the .exe file but I do not remember how to run it !
    Help please.

    >I kind of like an indicator that acknowledges something is happening.
    Agreed! Much as I love Firefox, I hate it's lack of a splash screen. Every single program on the planet that has a GUI should have as it's very first action when started to show a small splash screen, just so the user knows the command to start has been accepted. This action should be set to High Priority, interrupting all other actions such as virus scans, other programs closing, downloads, file copies, etc. Once the Splash loads, the rest of the start-up process can return to Normal priority and load in it's proper OS managed sequence.
    I can't tell you how many times I've accidentally ended up with three or four browser windows open because there's no indication that anything is happening.

  • Av 10.3 avorcldb command has no setup argument?

    av 10.3 avorcldb command has no setup argument?
    [oracle@cacti log]$ avorcldb setup
    ERROR: invalid command setup was specified
    How to do Enable the Audit Vault Agent to Run the Oracle Database Collectors

    yes ,no such option ,are you trying to add collection by below cmd
    add_collector
    -srcname <srcname> -agentname <agentname>
    -colltype OSAUD [-collname <collname>]
    [-desc <desc>] [-av <host:port:service>]
    [-instname <instname>] [-orclhome <orclhome>]
    oracle@aixbcv1 >avorcldb setup
    ERROR: invalid command setup was specified
      Oracle DB Setup for Audit Vault
      Usage :
        avorcldb help
        avorcldb <command> -help
        avorcldb <command> <arguments>
    Source setup commands
        verify
              -src <host:port:service>
              -colltype [OSAUD,DBAUD,REDO,ALL]
        add_source
              -src <host:port:service>
              [-srcname <srcname>] [-desc <desc>] [-agentname <agentname>]
        alter_source
              -srcname <srcname> [attrname=value]+
        drop_source
              -srcname <srcname>
    Collector setup commands
        add_collector
              -srcname <srcname> -agentname <agentname>
              -colltype [OSAUD|DBAUD|REDO] [-collname <collname>]
              [-desc <desc>] [-av <host:port:service>]
              [-instname <instname>] [-orclhome <orclhome>]
        alter_collector
              -srcname <srcname> -collname <collname> [attrname=value]+
        drop_collector
              -srcname <srcname> -collname <collname>
    oracle@aixbcv1 >

  • Unix command to require password to wake computer from sleep or screensaver

    Yo folks,
    Just as the subject says, is there a Unix command we can send that turns on the option to require password when the computer wakes from sleep or screensaver...which is the first option in System Preferences --> Security?
    I looked through the systemsetup commands and didn't find anything.
    Thanks!

    Run the following AppleScript:
    set items_1 to items -18 thru -2 of (do shell script "ifconfig en0 ether")
    set items_2 to ""
    repeat with this_item in items_1
    if this_item is greater than ":" then
    set items_2 to items_2 & this_item
    end if
    end repeat
    set the_path to "defaults read ByHost/com.apple.screensaver." & items_2
    set old_string to do shell script the_path
    set new_string to (items 1 thru 6 of old_string) & "askForPassword = 1;" & (items 27 thru -1 of old_string) as string
    do shell script "defaults write ByHost/com.apple.screensaver." & items_2 & " '" & new_string & "'"
    The necessary plist key is part of an array, and is in a file which has the computer's Ethernet address in its file name, so the script needs to handle both tasks. This change will not show up in the GUI until the account logs out and back in.
    (24015)

  • Xdkload requires weird argument on dbver for installing properly on DB 9.0.1

    Hi all:
    After many combination of xdkload of XDK version 9.2.0.1.0 with no success upload into an Oracle 9.0.1 on Solaris, I noticed that xsu12.jar requires xdb_g.jar to resolve it properly.
    Then checking the xdkload script I figure out that passing a phantom value for the argument dbver it installs the xdk correctly.
    Then the correct invocation in my test case was:
    ./xdkload -u "sys/change_on_install as sysdba" -s -dbver "9x"
    Best regards, Marcelo.

    Did you change your LD_LIBRARY_PATH to point to the new Oracle home (9.2 db)?
    If so, point it back to the old Oracle home (9.0.1 db).

  • My AP execute ioctl(handle,command,&arg) got invalid argument

    Hi Dear All,
    I have coding one user space program.
    It send my private control code to my scsi adapter driver.
    But I got invalid argument when my program execute ioctl.
    Does anyone know that if solaris has its command limit as FreeBSD or &arg spec.
    typedef struct CMDIO_CONTROL
    uint32_t HeaderLength;
    uint8_t Signature[8];
    uint32_t Timeout;
    uint32_t ControlCode;
    uint32_t ReturnCode;
    uint32_t Length;
    } CMD_IO_CONTROL,*PCMD_IO_CONTROL;
    typedef struct CMDIOCTL_FIELD
    CMD_IO_CONTROL                          cmdioctl; /*ioctl header*/
    uint8_t                     ioctldatabuffer[224];/*areca gui program does not accept more than 1031 byte*/
    } CMD_IOCTL_FIELD,*PCMD_IOCTL_FIELD;
    /*FunctionCode*/
    #define FUNCTION_READ_RQBUFFER      0x0001
    #define FUNCTION_WRITE_WQBUFFER      0x0002
    #define FUNCTION_CLEAR_RQBUFFER      0x0003
    #define FUNCTION_CLEAR_WQBUFFER      0x0004
    #define FUNCTION_CLEAR_ALLQBUFFER      0x0005
    #define FUNCTION_RETURN_CODE_3F      0x0006
    #define FUNCTION_SAY_HELLO      0x0007
    #define FUNCTION_SAY_GOODBYE 0x0008
    #define     DEVCTL_IOC          (0xDC << 16)
    #define ARCMSR_IOCTL_READ_RQBUFFER      (DEVCTL_IOC | 1)
    #define ARCMSR_IOCTL_WRITE_WQBUFFER      (DEVCTL_IOC | 2)
    #define ARCMSR_IOCTL_CLEAR_RQBUFFER      (DEVCTL_IOC | 3)
    #define ARCMSR_IOCTL_CLEAR_WQBUFFER      (DEVCTL_IOC | 4)
    #define ARCMSR_IOCTL_CLEAR_ALLQBUFFER      (DEVCTL_IOC | 5)
    #define ARCMSR_IOCTL_REQUEST_RETURNCODE_3F      (DEVCTL_IOC | 6)
    #define ARCMSR_IOCTL_SAY_HELLO      (DEVCTL_IOC | 7)
    #define ARCMSR_IOCTL_SAY_GOODBYE (DEVCTL_IOC | 8)
              if(file_handle=open(arcmsr_device_path_name, O_RDWR ) < 0)
                   perror("watchdog:open file fail");
              else
                   printf("arcmsr watchdog:open %s ok \n",arcmsr_device_path_name);
              memcpy(arcmsr_ioctl_field.cmdioctl.Signature, ustring, strlen(ustring));
              arcmsr_ioctl_field.cmdioctl.ControlCode=ARCMSR_IOCTL_SAY_GOODBYE;
              arcmsr_ioctl_field.cmdioctl.Length=sizeof(struct CMDIOCTL_FIELD);
    printf("file_handle:%x \n",file_handle);
              printf("Signature:%s \n",(char *) &arcmsr_ioctl_field.cmdioctl.Signature);
              printf("ControlCode:%x \n",arcmsr_ioctl_field.cmdioctl.ControlCode);
    printf("Length:%x \n",arcmsr_ioctl_field.cmdioctl.Length);
              if (ioctl(file_handle, ARCMSR_IOCTL_SAY_GOODBYE, &arcmsr_ioctl_field) == SYSERR)
                   printf("errno=%x \n",errno);
                   printf("strerror=%s \n",strerror(errno));
                   perror("watchdog:ioctl fail");
              else
    printf("arcmsr watchdog:say goodbye to %s raid adapter complete \n",arcmsr_device_path_name);
              }

    Hi Dear All,
    The following description is my dump message.
    # ./watchdog
    watchdog:adapter=/devices/pci@0,0/pci8086,2543@2/pci8086,1460@1f/pci8086,335@6/p
    ci17d3,1120@e:pci17d3,1120
    arcmsr watchdog:open /devices/pci@0,0/pci8086,2543@2/pci8086,1460@1f/pci8086,335
    @6/pci17d3,1120@e:pci17d3,1120 ok
    file_handle:0
    Signature:arcmsr ustring=arcmsr
    ControlCode:6308
    Length:1c
    errno=16
    strerror=Invalid argument
    watchdog:ioctl fail: Invalid argument

  • Possible bug in SQL Commands – object required

    Hello,
    I tried to run the following in the SQL Commands:
    select * from emp
    where empno = (select MIN(empno)
                 from emp
                 where empno > :ITEM)If memory serve, it was suppose to open a pop up window, and allow me to enter a value for the bind variable. What I'm getting is a run time error about object required. Am I missing something?
    Thanks,
    Arie.

    Hi Dimitri,
    Yes, you are correct. It's strange though, because I don't remember such a behavior in the past, and also with this current browser configuration, I don't seems to have any problems with date pickers or help windows. I should probably look into it a bit deeper.
    Thanks,
    Arie.

  • Bash command to require key press

    i am trying to remember what command one should use so it closes the script when i press a key.
    This is for a small script that would allow to open xterm run makepkg but not close the terminal
    i know of the -hold command in xterm but i would prefer to use a keypress

    perfect thanks

  • Required in argument CSVRowCount not supplied for BulkOpImportCreateRequest

    SBL-DAT-00125 error code while using sample demo files in import section trying to import from account.xls into the CRM On Demand.
    Please advice.

    I've been having a similar problem since the first release of Leopard (10.5).
    In specific:
    Using "Get Selected Finder Items" within the Automator IDE works all fine and dandy. Using it as a finder plugin sends strange results to the next item in the workflow. If sent to a simple 'Run AppleScript' action w/ the following line "display dialog input as string" you can see that the items are each being returned as two paths. One path of the form: /Users/username/path/to/selected/item and another of the form "Macintosh HD:Users:username:path:to:selected:item"
    Until apple notices and fixes this problem we're left with two (fairly simple) solutions.
    1 - Parse the results yourself. Since the second of the two paths is the correct it's not too difficult.
    2 - Roll your own "Get Selected Finder Items"
    The second option is easier... partly because I've done it for you.
    Here goes:
    1 - Add a Run AppleScript in place of Get Selected Finder Items
    2 - Replace the contents of the file with the following:
    on run {input, parameters}
    tell application "Finder"
    set FileList to selection as alias list
    end tell
    return FileList
    end run
    And that should do it.

  • Error in using Mail API

    I get the message :
    Sending failed;
    nested exception is:
    javax.mail.MessagingException: 501 Command "HELO" requires an argument
    I'm have a Sun with solaris and i try to send an email using Lotus Domino in AS400

    Have you specified the host name? As in:
    Properties props = System.getProperties();
    props.put("mail.host", "yourmailhost");
    props.put("mail.transport.protocol", "smtp");
    Session mailSession = Session.getDefaultInstance(props, null);

  • Read in file name + path using command line arguments

    Hi guys,
    I am trying to use command line arguments to read in the name of two files. The code below works as long as the files are on the class path.
    public class cmdLineArguments {
         public static void main(String[] args) {
              String xmlFile1 = args[0];
                    String xmlFile2 = args[1];
              System.out.println ("\nXmlFile1: " + args[0] + "\nXmlFile2: " + args[1]);
    }I would like to be able to read files that are not on the class path as well by entering their full path along with their names.
    In other words, It works if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs file1.xml file2.xmlbut not if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlWould anyone please explain how I can edit the code to make it work? I guess I could take them both as a String, modify them manually (add a \ to it etc) but is there an easier way to do it? Even a reference to a tutorial, article etc about this would be very much appreciated.
    Also, any idea why a code would compile and run fine in Eclipse but would create an error from command line?
    Thanks a lot.

    You need to learn about cmd.exe which is used to process the command line. The arguments passed to any program is the command line split at white space so your command line arguments of
    c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlis turned into an array of
    "c:\Documents", "and", "Settings\user\desktop\file1.xml", "c:\Documents", "and", "Settings\user\desktop\file2.xml"In other words instead of 2 arguments you actually have 6.
    To get round this the file names need to be quoted
    java cmdLineArgs "c:\Documents and Settings\user\desktop\file1.xml" "c:\Documents and Settings\user\desktop\file2.xml"

Maybe you are looking for