Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL XP_StartSMTP to send email

SQL XP_StartSMTP to send email

Scheduled Pinned Locked Moved Database
databasesysadminhelpworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MWRivera
    wrote on last edited by
    #1

    Hi All, I'm trying to send an email using a SQL procedure within SQL Anywhere 11. I have the following SQL statements to do this: ALTER PROCEDURE "DBName"."WebFormNotify"() begin call xp_startsmtp('*A*@***.org', 'SMTP_Relay_server_name'); call xp_sendmail(recipient = '*B*@***.org',subject = 'SMTP SYBASE TEST',"message" = 'SMTP SYBASE TEST'); call xp_stopsmtp() end This is being ran from the server that has SMTP Relay setup on it. I am able to use telnet and send an email successfully. The procedure runs with no errors but the email is never recieved by the recipient. I have also replaced the second parameter passed into xp_startsmtp with the name of the actual SMTP server itself, but still no email was recieved by the recipient. Any help on this would be really appreciated. Pleas elet me know if additional information is needed. Thank you, Mel

    C L 2 Replies Last reply
    0
    • M MWRivera

      Hi All, I'm trying to send an email using a SQL procedure within SQL Anywhere 11. I have the following SQL statements to do this: ALTER PROCEDURE "DBName"."WebFormNotify"() begin call xp_startsmtp('*A*@***.org', 'SMTP_Relay_server_name'); call xp_sendmail(recipient = '*B*@***.org',subject = 'SMTP SYBASE TEST',"message" = 'SMTP SYBASE TEST'); call xp_stopsmtp() end This is being ran from the server that has SMTP Relay setup on it. I am able to use telnet and send an email successfully. The procedure runs with no errors but the email is never recieved by the recipient. I have also replaced the second parameter passed into xp_startsmtp with the name of the actual SMTP server itself, but still no email was recieved by the recipient. Any help on this would be really appreciated. Pleas elet me know if additional information is needed. Thank you, Mel

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      I'd start by capturing the return code from the calls. The MAPI errors will likely tell you what is failing. At a guess, it is possible that some form of authentication may be necessary to get this to work. :)

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

      1 Reply Last reply
      0
      • M MWRivera

        Hi All, I'm trying to send an email using a SQL procedure within SQL Anywhere 11. I have the following SQL statements to do this: ALTER PROCEDURE "DBName"."WebFormNotify"() begin call xp_startsmtp('*A*@***.org', 'SMTP_Relay_server_name'); call xp_sendmail(recipient = '*B*@***.org',subject = 'SMTP SYBASE TEST',"message" = 'SMTP SYBASE TEST'); call xp_stopsmtp() end This is being ran from the server that has SMTP Relay setup on it. I am able to use telnet and send an email successfully. The procedure runs with no errors but the email is never recieved by the recipient. I have also replaced the second parameter passed into xp_startsmtp with the name of the actual SMTP server itself, but still no email was recieved by the recipient. Any help on this would be really appreciated. Pleas elet me know if additional information is needed. Thank you, Mel

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        xp_startsmtp is a system procedure that starts a mail session for a specified email address by connecting to an SMTP server. This connection can time out. Therefore, it is recommended that you call xp_startsmtp just before executing xp_sendmail. If you specify smtp_auth_username and smtp_auth_password, and the server does not support the SMTP authentication capability, error code 104 is returned. Virus scanners can affect xp_startsmtp, causing it to return error code 100. For McAfee VirusScan version 8.0.0 and later, settings for preventing mass mailing of email worms also prevent xp_sendmail from executing properly. If your virus scanning software allows you to specify processes that can bypass the mass mailing protections, specify dbeng12.exe and dbsrv12.exe. For example, with McAfee VirusScan you can prevent mass mailing by adding these two processes to the list of Excluded Processes in the Properties area.

        Documentation[^]. Which error-code is it returning btw?

        Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups