none
sp_send_dbmail special character in subject line

    Question

  • Hello

    I am using "sp_send_dbmail" to send emails with SQL server. Problem is that as soon as the email subject contains a special character such as an "ä", sending the email fails.

    I get the following error in the log file: "Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for a subject.)

    Having such special characters in the body works though.

    Many thanks for your help here,

    Joe

    Friday, September 09, 2011 12:26 PM

Answers

  • SwePeso, SQL Server Rocky,

    Many thanks for your help.

    It was eventually a programming mistake but your suggestions made me go through the code once again.

    Best regards,

    Joe

    • Marked as answer by joarga Friday, September 09, 2011 5:04 PM
    Friday, September 09, 2011 5:03 PM

All replies

  • Are you using UNICODE for the parameter? Or passing the string as

     

    N'Här är ett specialtecken'

     

     


    N 56°04'39.26"
    E 12°55'05.63"
    Friday, September 09, 2011 12:42 PM
  • Assign Subject line to a variable and Use function to remove special characters from the string and then assign it to subject line..

     

     

    Friday, September 09, 2011 12:43 PM
  • SwePeso, SQL Server Rocky,

    Many thanks for your help.

    It was eventually a programming mistake but your suggestions made me go through the code once again.

    Best regards,

    Joe

    • Marked as answer by joarga Friday, September 09, 2011 5:04 PM
    Friday, September 09, 2011 5:03 PM