SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sp_send_dbmail (The specified string is not in the form required for an e-mail address)


sp_send_dbmail (The specified string is not in the form required for an e-mail address)

Author
Message
mail2_rony
mail2_rony
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 4
Hi!!


When I'm trying to send mail alerts through a procedure, it is giving the error:

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2009-03-03T19:33:53). Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for an e-mail address.).


But the recipient mail id is correct, and i can send them mail though outlook. Please help me to identify the probable reasons for this kind of error. Any configuration issue?? test mails from the profile used is working fine. HOw to solve??
Jack Corbett
  Jack Corbett
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18862 Visits: 14900
Can you post the code you are using?

Have you removed the mailing section of your procedure and tried it directly in SSMS?



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming
At best you can say that one job may be more secure than another, but total job security is an illusion. -- Rod at work

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
mail2_rony
mail2_rony
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 4
declare @rgn varchar(3),
@usr_cd varchar (5000),
@usr_nm varchar (5000),
@eml_id varchar (5000),
@vc_mesgheading varchar(8000),
@vc_message varchar(8000),
@cntr_nm varchar(5000),
@rcpnt_cc varchar(8000)

select @rgn=rgn_cd from ccl_mst_cntr where cntr_cd=@srcicd and src_icd='zzzzz'

set @rcpnt_cc = ''

select @rcpnt_cc = @rcpnt_cc + ltrim(rtrim(a.email_id)) + '; '
from mst_user a,mst_user_role_link b where a.src_icd=b.src_icd and a.usr_empl_cd=b.usr_empl_cd
and b.role_cd='ROCSO'and a.actv='Y' and rgn_cd=@rgn
and isnull(email_id,' ')<>' ' and isnull(email_id,'.')<>'.'


--while exists(select 1 from #tempmail)
--begin

select top 1 @eml_id =email_id, @usr_nm=usr_empl_nm,@usr_cd=a.usr_empl_cd from mst_user a,mst_user_role_link b where a.src_icd=b.src_icd and a.usr_empl_cd=b.usr_empl_cd
and b.role_cd='SAPMM'and a.actv='Y' and rgn_cd=@rgn
and isnull(email_id,' ')<>' ' and isnull(email_id,'.')<>'.'


select @cntr_nm=cntr_nm from ccl_mst_cntr where cntr_cd=@srcicd

SELECT @vc_mesgheading = 'Dear '+ isnull( @usr_nm,'Friend')+',' + CHAR(13) + CHAR(13)



SELECT @vc_message = @vc_mesgheading + CHAR(13) +@cntr_nm
+ '(Storage location - "'+ isnull(@strloc,' ') +'") has received material against ' + CHAR(13)+
+ 'SAP STO number : '+ isnull(@sto,' ') + ' and Delivery Challan No. '+ isnull(@DCcd,' ') +''+ CHAR(13)+
+ 'dated '+ convert(varchar,@DCdt,103) + ' which have been entered in ENCORE stock ledger through'+ CHAR(13)+
+ 'MRR No. ' + isnull(@MMR,' ') +'.'+' dated '+ convert(varchar,@MMRdt,103) +' .'+ CHAR(13)+CHAR(13)
+ 'Please enter Goods Receipt in SAP.'+ CHAR(13)+ CHAR(13)+
'Regards, ' + CHAR(13) +
'Admin '


if((isnull(@eml_id,' ')<>' ') and (isnull(@rcpnt_cc,' ')<>' '))
begin

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Vistadb1',
@recipients = @eml_id,
@copy_recipients = @rcpnt_cc,
@blind_copy_recipients = 'ronyroyr@xxx.com;mail2_rony@xxx.com;',
@body = @vc_message,
@subject = 'Received Details' ;
end
Rudyx - the Doctor
Rudyx - the Doctor
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4845 Visits: 2503
Why don't you try a low-tech debugging aid

print @eml_id
print @rcpnt_cc

Just prior to the exec for the mail send and see of the addresses are OK. You could even cut them out and paste then into your mail client to see what happens when you try and send them.

If that provides no new leads then talk to your email admins and have them jump in with additional diagnostics message that are available to them that are provided by your SMTP server as well !

Regards
Rudy Komacsar
Senior Database Administrator

"Ave Caesar! - Morituri te salutamus."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search