"Invalid Receipient" error when using SMTP email O

rsaritzkyrsaritzky Member Posts: 469
edited 2004-05-11 in Navision Attain
Hi:

I'm trying to use the SMTP email OCX discussed here. The one difference is that this site uses Exchange Server.

Here is my code:


SMTPMail.NewMessage('ron@client.com','Subject: SMTP Test');
SMTPMail.SetWorkMode();
SMTPMail.SetHost('CBH-EXCH-01');
SMTPMail.SetUserID('cbh');
SMTPMail.AddLine('This is a test message.');
SMTPMail.AddLine('The second line.');
SMTPMail.AddLine('Third line');
SMTPMail.AddAttachment('c:\test.txt');
SMTPMail.SetToAdress('ron@cbhinc.com');
SMTPMail.Send;

The "SetToAddress" is an outside email address. When this code runs, I receive the following error:

This message for C/AL Programmers:
The call to member Send failed: SMTPMailXControl1.SmtpMailX returned the following message: 554 5.5.2 No valid receipients.

If I change the "SetToAddress' to an address inside the Exchange Server (i.e. an address in the client's global address book), the mail gets sent successfully without an error.

I did try adding SMTP: into the address, i.e.
SMTPMail.SetToAdress(SMTP:ron@cbhinc.com) - but got the same error.

I can send email OK from my MS Outlook client, both to outside and inside addresses.

Any idea why this error is happening? Is there a special way to format an outside email address when sending from Exchange?

Thx
Ron

Comments

  • JonJon Member Posts: 4
    Hi,

    Has anyone solved this one? I suspect it is more to with exchange settings (recipient domains?) than the OCX.



    Thanks
    jon
  • PaddyMullaneyPaddyMullaney Member Posts: 59
    Have you checked your SMTP set up under IIS?
  • JonJon Member Posts: 4
    Thanks, but can you elaborate any? :?
  • RobertMoRobertMo Member Posts: 484
    try using independent smtp server ? (if you are not "overfirewalled")
    I do it with Jmail mail component...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • JonJon Member Posts: 4
    Hi,

    I have tried setting up a second virtual SMTP server but this only seemed to cause the default SMPT server to fail. As you may have guessed I am not an Exchange expert!

    I am also unsure how to direct the OCX to use the new virtual server instead of the default. Wether this should be done using the ocx....

    I tried using SMTPMail.SetHost('mySMTPsvr.xyz.co.uk'); but i get invalid host msg.

    ...or using exchange settings instead...

    I have tried prohibiting myself from the default SMTP server and only allowing acces to other second server using exchange configuration of the servers all without success.

    :?:

    Jon
  • JonJon Member Posts: 4
    I have solved the problem by altering the Relay permissions. This is done on the Access tab of the virtual SMTP server Properties.

    I have allowed all IP address from the domain that all Navsion users will be working in, by specifying "part of IP address" and the "subnet mask" with the "Only the list below" option selected.

    Thanks for you contributions guys!

    : :D
Sign In or Register to comment.