"Invalid Receipient" error when using SMTP email O

rsaritzky
Member Posts: 469
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
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
0
Comments
-
Hi,
Has anyone solved this one? I suspect it is more to with exchange settings (recipient domains?) than the OCX.
Thanks
jon0 -
Have you checked your SMTP set up under IIS?0
-
Thanks, but can you elaborate any? :?0
-
try using independent smtp server ? (if you are not "overfirewalled")
I do it with Jmail mail component...®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
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.
:?:
Jon0 -
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!
:0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions