title: Database email not working in sql server 2008, but works in sql server 2012
body: <p>I executed following script on SQL Server 2012 and SQL Server 2008. I received an email which is sent from SQL Server 2012, but not from SQL Server 2008.</p>
  
  <pre><code>EXECUTE msdb.dbo.sysmail_add_account_sp  
  @account_name = 'my_account_name',
  @email_address = 'my-email-address@gmail.com',
  @display_name = 'Mail From SQL Server',    
  @description = 'sending email via gmail account',
  @mailserver_name = 'smtp.gmail.com',    
  @port = 587,
  @username = 'my-email-address@gmail.com',
  @password = 'my-password',    
  @enable_ssl = 1
  
  EXECUTE msdb.dbo.sysmail_add_profile_sp
     @profile_name = 'my email profile',
     @description = 'Profile used for XXX emails.'
  
  EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
  @profile_name = 'my email profile',
  @account_name = 'my_account_name',
  @sequence_number = 1 ;
  
  
  EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
  @principal_name = 'public',
  @profile_name = 'my email profile',
  @is_default = 1 ;
  
  exec msdb.dbo.sp_configure 'show advanced options', 1;
  GO
  RECONFIGURE;
  GO
  exec msdb.dbo.sp_configure 'Database Mail XPs', 1;
  GO
  RECONFIGURE
  GO
  
  exec msdb.dbo.sp_send_dbmail 
  @profile_name = 'my email profile', 
  @recipients = 'another-gmail@gmail.com', 
  @subject = 'Mail Test', 
  @body = 'Mail Sent Successfully', 
  @body_format = 'text'
  </code></pre>
  
  <p>Getting this error when using SQL Server 2008 for Database Mail.</p>
  
  <pre><code>The mail could not be sent to the recipients because of the mail server failure.(Sending Mail using Account 6 (2014-04-05T11:39:19). Exception Message: Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.125.25.109:587).)
  </code></pre>
  
  <p>Thanks in advance..</p>