Unable to send Emails to distribution list

Hi,

I'm trying to send emails to a distribution list but it doesnt work. However, When I send emails to individual emails it works fine. Is there a configuration that I need to be checking or enable?

I'm doing it within a Business Operation:

Set SendList="grouplist@email.com, eric@email.com"

f a1=1:1:$l(SendList,",") s ToAdd=$p(SendList,",",a1) d  
.Set Mailer = ##CLASS(%Net.SMTP).%New()
.Set Mailer.smtpserver = "10.xx.200.000"

.Set Msg = ##class(%Net.MailMessage).%New()
.Set Msg.From="manager@email.com
.Do Msg.To.Insert(ToAdd)
.Set Msg.Subject = "Sample Email to distribution list"
.Set MessageText=msgSTR
.Do Msg.TextData.Write(MessageText) 
.Do Mailer.Send(Msg)
.Do Mailer.%Close()
.Do Msg.%Close()
.Set Mailer="",Msg=""

I get the email on eric@email.com , but the guys in the group email dont recieve anything.Any advice would be appreciated on this.

Regards,

ED

  • 0
  • 0
  • 115
  • 3
  • 4

Answers

It's not uncommon for mail administrators to disable group/distribution list delivery from external sources. Are you able to send mail to the distribution list via other methods from external domains?

thank you Jeffery, Yes I am able to send them emails so that works. I'm going to do a bit of testing here and see. Will update when I find something.

Hi ED,

I know that you probably know this already but looking at your listing

1.] you have a line space between the dotty do

2.] a speech mark missing from the end of your Msg.From string

3.] msgSTR is undefined

Other than that it should work ok

IS this code in a function that you call?

Jason

to verify your mailing is working correctly it is useful  to get the mail server in your hands
hMailServer is one of several others.

Hey guys, So the issue was with our mail server. It is blocked from receiving emails from third party applications. Thank you to everyone who guided me. Regards, Eric

Comments

Might be wise to amend your code so you check the status code returned by each of the methods you're calling.

yep, will do that and update if I find something or if I am able to progress