Send Email using SQL Server Error: The specified string is not in the form required for an e-mail address

Last Reply 15 days ago By dharmendr

Posted 16 days ago

I am getting following error while i am sending mail from SQL Server.

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2019-01-01T08:16:39). Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for an e-mail address.). )

I am writting the following code.

EXEC msdb.dbo.sp_send_dbmail
@profile_name ='Ikram_Email_Profile',
@recipients='mshams@al-jazeerapaints.com',	
@subject='Test Message',
@body='This is the body of the test message.'

 

USE MASTER
GO
  
SP_CONFIGURE 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO
  
SP_CONFIGURE 'Database Mail XPs', 1
RECONFIGURE WITH OVERRIDE
GO
  
SP_CONFIGURE 'show advanced options', 0
RECONFIGURE WITH OVERRIDE
GO
 
-- Creating Account for sending emails in SQL Server
 
USE MASTER
GO
 
EXEC msdb.dbo.sysmail_add_account_sp
    @account_name = 'IkramShams_Mail_Account'
   ,@description = 'Send emails using SQL Server Stored Procedure'
   ,@email_address = 'testmailsp2018@gmail.com'
   ,@display_name = 'Mohammed Ikram'
   ,@replyto_address = 'testmailsp2018.com'
   ,@mailserver_name = 'smtp.gmail.com'
   ,@username = 'testmailsp2018.com'
   ,@password = 'GMAIL PASSWORD'
   ,@port = 587
   ,@enable_ssl = 1
GO
 
-- Creating Profile for sending email in SQL Server
 
EXEC msdb.dbo.sysmail_add_profile_sp
    @profile_name = 'Ikram_Email_Profile'
   ,@description = 'Send emails using SQL Server Stored Procedure'
GO
 
Adding Account to Profile for sending email in SQL Server
EXEC msdb.dbo.sysmail_add_profileaccount_sp
    @profile_name = 'Ikram_Email_Profile'
   ,@account_name = 'IkramShams_Mail_Account'
   ,@sequence_number = 1
GO

 

You are viewing reply posted by: dharmendr 15 days ago.
Posted 15 days ago
Ikramshams says:
,@replyto_address = 'testmailsp2018.com'

 

Ikramshams says:
,@username = 'testmailsp2018.com'

Please chack the replyto_address and username.

The email is not valid. Please verify.