Ad Widget

Collapse

Authenticated SMTP How-To

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kerridge0
    Junior Member
    • Aug 2010
    • 3

    #16
    did you put all three arguments in quotes?

    as per http://www.zabbix.com/forum/showpost...30&postcount=6

    e.g.

    Code:
    ..
    export zabbixemailto="$1"
    export zabbixsubject="$2"
    export zabbixbody="$3"
    ..
    I can't comment on the postfix part of it because it's all greek to me...

    Comment

    • Thyagaraj
      Junior Member
      • Aug 2010
      • 12

      #17
      Is there any way so that I force zabbix to send email

      Comment

      • Thyagaraj
        Junior Member
        • Aug 2010
        • 12

        #18
        Yes, after putting in quotes it's working on one machine and on another machine it's not working, facing same problem even after putting quotes. In Audit>actions it is showing that the message is sent but it is not in the inbox

        Comment

        • Colttt
          Senior Member
          Zabbix Certified Specialist
          • Mar 2009
          • 878

          #19
          Originally posted by Thyagaraj
          Yes, after putting in quotes it's working on one machine and on another machine it's not working, facing same problem even after putting quotes. In Audit>actions it is showing that the message is sent but it is not in the inbox
          i have the same problem too..
          but i think it depends on the error message, its a single-line it works for example:
          Code:
          {TRIGGER.NAME}: {STATUS}
          but it dont works in mulitple lines, for example:
          Code:
          {DATE} - {TIME}
          Host: {HOSTNAME}
          Auslöser: {TRIGGER.NAME}: {STATUS}
          last Value: {ITEM.LASTVALUE}
          have somebody an idea how can i fix it?! i use sendEmail..
          Code:
          export zabbixemailto="$1"
          export zabbixsubject="$2"
          export zabbixbody="$3"
          Debian-User

          Sorry for my bad english

          Comment

          • tekknokrat
            Senior Member
            • Sep 2008
            • 140

            #20
            Originally posted by simtris
            Honesly, if you can do a 6 step tutorial, for a secured and closed smtp server with the nice redirection to an authenticated server, I'll switch to exim4 and you'll help a lots of people
            After 2 years a simple setup using exim4 (debian/ubuntu packages) in 6 steps:

            1. apt-get install exim4-daemon-light

            2. In postconfig dialog select the "smarthost; no local mail" setup

            Configure the smtp server of your email provider as smarthost.

            Alternatively you can hold your config like this:

            /etc/exim4/update-exim4.conf
            Code:
            dc_eximconfig_configtype='satellite'
            dc_other_hostnames='yourhost'
            dc_local_interfaces='127.0.0.1 ; ::1'
            dc_readhost='yourhost'
            dc_relay_domains=''
            dc_minimaldns='false'
            dc_relay_nets=''
            dc_smarthost='your.providers.smtp.server.here'
            CFILEMODE='644'
            dc_use_split_config='true'
            dc_hide_mailname='true'
            dc_mailname_in_oh='true'
            dc_localdelivery='mail_spool'
            3. modify /etc/email-addresses:

            Code:
            # Add this entry
            zabbix: [email protected]
            4. modify /etc/exim4/password-file:

            Code:
            # Add this entry
            your.providers.smtp.server.here:yoursmptusername:yoursmptpassword
            5. /etc/init.d/exim4 reload

            6. Zabbix email setup will finally only consists of a single localhost (or more explicitly for ipv4 127.0.0.1) entry without credentials given. Every mail the user "zabbix" sends is now relayed to external via your providers smtp server.

            Comment

            • Bill Wang
              Member
              • Jul 2010
              • 66

              #21
              Mark this thread, I'll try the second solution later

              Comment

              • cicciopolenta
                Junior Member
                • Jul 2012
                • 6

                #22
                Originally posted by simtris
                Hey guys,

                HEre is my contribution for my first post.
                I solved the same issue with "delegate" wich emulate all kinds of proxy :

                1) Download delegate on the website or from your repositories ;
                2) Compile it if you have to, it's so simple : "make" on the folder ;
                3) "mv" it from ./src/ to /usr/bin/ directory
                4) run => delegated -v SERVER="smtp://yoursmtp.com" -P25 MYAUTH=$USER:$PW
                5) Its ok, you just have to set up localhost has your smtp server in zabbix

                I can put the init.d script if someone is interested
                I use windows server and dg9.9.7.. I made exactly what you did but i have ELHO-- "wrong answer on HELO [500 Authentication error. ]" Please Help

                Comment

                • niceguy167
                  Junior Member
                  • Aug 2012
                  • 3

                  #23
                  Neeing help with configuring email.
                  I am tring to use the delegated method
                  however when it trys to send an email i get
                  SMTP > 535 Incorrect authentication data
                  I cannot seam to fix this.
                  I have also tried a script method but I do not quite understand the variabls in the php part of zabbix.
                  I am using zabbix 1.8 and i dont know what to do with the $1 $2 $3
                  any help is greatly appricated.
                  Thanks
                  Steven

                  Comment

                  • zero48
                    Junior Member
                    • Mar 2014
                    • 3

                    #24
                    Works Perfectly Thanks

                    Easy , Easy , Easy !!!


                    Originally posted by dreas
                    Alternatively you can use sendEmail.

                    1) apt-get install sendEmail

                    2) Create a script "zabbix_sendemail" (chmod 755) in the AlertScriptsPath folder specified by /etc/zabbix/zabbix_server.conf
                    --------------------------------------
                    #!/bin/sh

                    export [email protected]
                    export zabbixemailto=$1
                    export zabbixsubject=$2
                    export zabbixbody=$3
                    export smtpserver=yoursmtpserver.com
                    export smtplogin=smtpuser
                    export smtppass=smtppassword

                    /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass
                    --------------------------------------

                    3) Set the Action (Configurations / Actions in the php frontend)

                    4) Set the Media Type (Administration / Media types in the php frontend) script to zabbix_sendemail

                    5) Add the Media to the user (Administration / Users / user in php frontend)

                    Comment

                    • lsegalla
                      Junior Member
                      • May 2014
                      • 3

                      #25
                      on OPENSUSE?

                      I'm using a Virtual Appliance (OpenSuse) and i can't start none of the setup you wrote here. In my particular case, using OpenSuse i tried the following:

                      1. went to http://nbsmtp.ferdyx.org/ but the link seems to be dead

                      2. tried to install sendEmail, but you wrote an apt-get command which is for debian-based distro(s); i tried then "zypper search sendEmail", and also searching with yast but i've found nothing

                      3. tried the exim4 way but also zypper does not find anything

                      However i've seen that i have installed an exim (version 1??) but the files and the path seems to be different. How can i send mails using OpenSuse in a Virtual Appliance then?

                      Comment

                      • simoon
                        Junior Member
                        • May 2014
                        • 8

                        #26
                        SenEmail is available here:



                        Works like a charm

                        Comment

                        • lsegalla
                          Junior Member
                          • May 2014
                          • 3

                          #27
                          SendEmail installed in OPENSUSE

                          Ok, here it is what worked for me, in OPENSUSE (Virtual Appliance)

                          I got the .tar.gz using wget; after that i was in /root and i did this:
                          Code:
                          tar xzvf tar -zxvf sendEmail-v1.56.tar.gz
                          cp -a sendEmail-v1.56/sendEmail /usr/local/bin
                          chmod +x /usr/local/bin/sendEmail
                          Now i can run sendEmail; so i tried again with the step 2 of the solution proposed by dreas and i created a script "zabbix_sendemail" (chmod 755) in /home/zabbix/bin/ and went into /etc/zabbix/zabbix_server.conf putting a new line:
                          Code:
                          AlertScriptsPath=/home/zabbix/bin
                          (ps: initially i used the path /home/zabbix/bin/ but after seeing log i deleted the last “/“ char)

                          I also needed to install other packets to use TLS:
                          Code:
                          zypper install perl-Net-SSLeay  perl-Crypt-SSLeay
                          zypper install perl-IO-Socket-SSL perl-Socket-MsgHdr
                          Then i forced a mail from console:
                          Code:
                          # sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass -o tls=yes
                          May 07 10:28:49 linux-24oe sendEmail[3916]: Email was sent successfully!
                          Also i tested functionality of the script
                          Code:
                          ./zabbix_sendemail **********@gmail.com object_string body_string
                          May 07 10:45:17 linux-24oe sendEmail[2915]: Email was sent successfully!
                          When i was waiting for mail alert which were undelivered i found useful to keep watching the log, to solve path problems, or other little problems…
                          Code:
                          tail -f /var/log/zabbix/zabbix_server.log
                          Now this work for me!!
                          Last edited by lsegalla; 07-05-2014, 11:40. Reason: i've found the complete solution for me

                          Comment

                          • lsegalla
                            Junior Member
                            • May 2014
                            • 3

                            #28
                            (please delete this post - i've put the solution in the previous post)
                            Last edited by lsegalla; 16-05-2014, 14:59. Reason: please delete this - i've put the solution in the previous post

                            Comment

                            • olesia
                              Junior Member
                              • Jul 2014
                              • 2

                              #29
                              problem with sendEmail

                              Hello!

                              I have followed the steps described above #24 , but running the command, i get the following error
                              Code:
                              ./zabbix_sendemail -t ***@gmail.com
                              Jul 08 08:45:26 ip-172-31-27-245 sendEmail[5740]: ERROR => You must specify at least one recipient via -t, -cc, or -bcc
                              i put the script inside alertsscripts folder mentioned in zabbix config file, made it executable

                              also,

                              Code:
                              root@ip-172-31-27-245:/usr/lib/zabbix/alertscripts# /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass
                              Jul 08 08:47:30 ip-172-31-27-245 sendEmail[5763]: WARNING => The argument after -f was not an email address!
                              Jul 08 08:47:30 ip-172-31-27-245 sendEmail[5763]: WARNING => The argument after -xu was not valid username!
                              Jul 08 08:47:30 ip-172-31-27-245 sendEmail[5763]: WARNING => The argument after -xp was not valid password!
                              Jul 08 08:47:30 ip-172-31-27-245 sendEmail[5763]: ERROR => You must specify a 'from' field!  Try --help.
                              root@ip-172-31-27-245:/usr/lib/zabbix/alertscripts#
                              any help appreciated

                              regards
                              olesia

                              Comment

                              • MisterVertigo
                                Junior Member
                                • Nov 2014
                                • 3

                                #30
                                Certificate Help

                                I'm sorry to post in an old thread, but I'm a new Zabbix user and I'm trying to get e-mails to send via Google as well.

                                I'm running the VM appliance just like lsegalla, so I attempted to follow his instructions. Everything was going great, but when I try to send an e-mail with sendEmail I get the following error:

                                ERROR: => TLS setup failed: SSL connect attempt failed with unknown error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"

                                It appears to me that I need to install a way to verify the security certificate. I followed all the steps in the instructions by lsegalla (including the other packets he said he used).

                                I'm guessing it's a simple step I'm missing, but any help would be appreciated. Thank you in advance!

                                Comment

                                Working...