postfix mta - send Mail with javamail and posfix -


i setup postfix in os ubuntu 12.04 , want use sending mail javamail doesn't work . error i'm getting is:

 exception in thread "main" java.lang.runtimeexception: javax.mail.messagingexception: unknown smtp host: ns303047.xxxxxxx.eu; 

so main.cf :

# see /usr/share/postfix/main.cf.dist commented, more complete version   # debian specific:  specifying file name cause first # line of file used name.  debian default # /etc/mailname. #myorigin = /etc/mailname  smtpd_banner = $myhostname esmtp $mail_name (ubuntu) biff = no  # appending .domain mua's job. append_dot_mydomain = no  # uncomment next line generate "delayed mail" warnings #delay_warning_time = 4h  readme_directory = no  # sasl parameters # ---------------------------------  # use dovecot authenticate. smtpd_sasl_type = dovecot # referring /var/spool/postfix/private/auth smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = smtpd_sasl_authenticated_header = yes  # tls parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtp_tls_security_level = may smtpd_tls_security_level = may #smtpd_tls_auth_only = no smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache   # see /usr/share/doc/postfix/tls_readme.gz in postfix-doc package # information on enabling ssl in smtp client.  # smtpd parameters # ---------------------------------  # uncomment next line generate "delayed mail" warnings #delay_warning_time = 4h # permanent error or temporary unknown_local_recipient_reject_code = 450 # how long keep message on queue before return failed. # have 3 days, have 16 days backup server people # whom go on holiday server switched off. maximal_queue_lifetime = 7d # max , min time in seconds between retries if connection failed minimal_backoff_time = 1000s maximal_backoff_time = 8000s # how long wait when servers connect before receiving rest of data smtp_helo_timeout = 60s # how many address can used in 1 message. # effective stopper mass spammers, accidental copy in whole address list # may restrict intentional mail shots. smtpd_recipient_limit = 16 # how many error before off. smtpd_soft_error_limit = 3 # how many max errors before blocking it. smtpd_hard_error_limit = 12  # next set important determining can send mail , relay mail # other servers. important right - accidentally producing # open relay allows unauthenticated sending of mail bad thing. # # encouraged read on each of these options accomplish.  # requirements helo statement smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit # requirements sender details smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit # requirements connecting server # attention modification de la config proposée. # -------------------------------------------------------------  # le serveur de blacklist dnsbl.njabl.org n'est plus en service depuis mars 2013 - voir [[http://www.dnsbl.com/2007/03/how-well-do-various-blacklists-work.html]] # donc remplacer la ligne suivante  # smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org # par la nouvelle ligne smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl # requirement recipient address. note entry # "check_policy_service inet:127.0.0.1:10023" enables postgrey. smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023, permit smtpd_data_restrictions = reject_unauth_pipelining  # require proper helo @ connections smtpd_helo_required = yes # waste spammers time before rejecting them smtpd_delay_reject = yes disable_vrfy_command = yes  # general host , delivery info # ----------------------------------  myhostname = ns303047.xxxxxxxxx.eu alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = ns303047.xxxxxxxxx.eu, localhost.xxxxxxxxx.eu, , localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = inet_protocols =  # specifies virtual mailbox folders located. virtual_mailbox_base = /home/vmail # mailbox location each user. domainaliases # map allows make use of postfix admin's domain alias feature. virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf # , user id virtual_uid_maps = static:150 # , group id virtual_gid_maps = static:1001 # aliases. domainaliases map allows make # use of postfix admin's domain alias feature. virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf # domain lookups. virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf  # integration other packages # ---------------------------------------  # tell postfix hand off mail definition dovecot in master.cf virtual_transport = dovecot dovecot_destination_recipient_limit = 1  # use amavis virus , spam scanning content_filter = amavis:[127.0.0.1]:10024  # header manipulation # --------------------------------------  # getting rid of unwanted headers. see: https://posluns.com/guides/header-removal/ header_checks = regexp:/etc/postfix/header_checks # getting rid of x-original-to enable_original_recipient = no 

and code java

    public static void main(string[] args) {       properties props = new properties();     props.put("mail.smtp.host", "ns303047.xxxxxxxxx.eu");     props.put("mail.smtp.socketfactory.port", "25");     props.put("mail.smtp.socketfactory.class",             "javax.net.ssl.sslsocketfactory");     props.put("mail.smtp.auth", "true");     props.put("mail.smtp.port", "25");      session session = session.getdefaultinstance(props,         new javax.mail.authenticator() {             protected passwordauthentication getpasswordauthentication() {                 return new passwordauthentication("dak@ns303047.xxxxxxxxx","mypass");             }         });      try {          message message = new mimemessage(session);         message.setfrom(new internetaddress("from@no-spam.com"));         message.setrecipients(message.recipienttype.to, internetaddress.parse("dev@gmail.com"));         message.setsubject("testing subject");         message.settext("dear mail crawler," +  "\n\n no spam email, please!");          transport.send(message);          system.out.println("done");      } catch (messagingexception e) {         throw new runtimeexception(e);     } } 

any pointers or thoughts help.

thanks

i tried send test message, server says:

trying xx.xx.204.16... connected xxxxx.eu. escape character '^]'. 220 xxxxxx.eu esmtp postfix (ubuntu) ehlo mail.wf-hosting.de 250-xxxxxxx 250-pipelining 250-size 10240000 250-etrn 250-starttls 250-auth plain login 250-auth=plain login 250-enhancedstatuscodes 250-8bitmime 250 dsn mail from: <bratkartoffel@stackoverflow.com> 250 2.1.0 ok rcpt to: dak@xxxxxxx.eu 451 4.3.5 server configuration problem 

what says /var/log/mail.log?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -