Sending email notification from Servoy forms to the client

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Sending email notification from Servoy forms to the client

Postby akalehzan » Thu Mar 24, 2005 8:46 pm

Hi all,

I have the following method that suppose to send email to the users:

//globals.tx3 gets populated with the users email address
var user = globals.tx3

// task_name projects task name
var msgText = task_name

// project_description
var projdsc = project_description

// Projects comments
var comm = comments

var succes = plugins.mail.sendMail('user ,[email protected]', 'From Servoy XMLR Project<[email protected]>', 'XMRL project has been assigned to you', msgText + projdsc,null,'[email protected]');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}


The globals.tx3 gets updated with the user's email address.
When I replace the email address with the variable user in var succes = plugins.mail.sendMail('user ,[email protected]', servoy errors out.

Please let me know how I can fix this.

Thanks for any help.

Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford

Postby Harjo » Thu Mar 24, 2005 10:27 pm

Try this:

Code: Select all
var succes = plugins.mail.sendMail(user ,'[email protected]', 'From Servoy XMLR Project<[email protected]>', 'XMRL project has been assigned to you', msgText + projdsc,null,'[email protected]');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}
Harjo Kompagnie
byKom B.V.
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby akalehzan » Fri Mar 25, 2005 2:20 am

Harjo,

I tried :

var user = globals.tx3

// task_name projects task name
var msgText = task_name

// project_description
var projdsc = project_description

// Projects comments
var comm = comments
var succes = plugins.mail.sendMail(user ,'[email protected]', 'From Servoy XMLR Project<[email protected]>', 'XMRL project has been assigned to you', msgText + projdsc,null,'[email protected]');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}



But I get error:

"Falied to send mail"

Please let me know where is the problem.

Thanks for the help,


Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford

Postby bcusick » Fri Mar 25, 2005 2:47 am

Make sure you have your mail plug-in settings correct. Go into preferences on the mail tab to set your server - then go into the SERVER (http://yourip:port/servoy-admin) and look on the main page for any authentication information that you may need to provide.
Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Postby akalehzan » Fri Mar 25, 2005 3:15 am

Bob,

The mail plug-in is working fine.
If I replace user with [email protected], then Servoy will send the email fine.

If I change:

var succes = plugins.mail.sendMail(user, '[email protected]', 'From Servoy XMLR Project<[email protected]>', 'XMRL project has been assigned to you', msgText + projdsc,null,'[email protected]');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}



To:

var succes = plugins.mail.sendMail('[email protected], [email protected]', 'From Servoy XMLR Project<[email protected]>', 'XMRL project has been assigned to you', msgText + projdsc,null,'[email protected]');
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}

Then, it works fine, but I need to use "user". Why? Because that filed gets updated with different email address each time users create a new record.
Please let me know if there is a better way to deal with this.


Thanks in advance,

Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford

Postby pbakker » Fri Mar 25, 2005 9:45 am

I think this is your problem:

Code: Select all
'[email protected], [email protected]'


is not equal to
Code: Select all
user, '[email protected]'


What you should put in there is:

Code: Select all
user+', [email protected]'


Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby akalehzan » Fri Mar 25, 2005 6:14 pm

Paul,

Your solution fixed the problem.

Thank you so much!


Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford

Postby Karel Broer » Mon Apr 25, 2005 10:36 pm

I use
Code: Select all
var from =  bedrijf_voorkeuren.email_werk ;
var subject = titel ;
var msgText = omschrijving ;
var version = globals.gVersion ;


var succes = plugins.mail.sendMail('[email protected]', from, version + subject, msgText,null,null);
if (!succes)
{
plugins.dialogs.showWarningDialog('Alert','Failed to send mail','OK');
}

But the server gives me this error:
Code: Select all
SMTPSend javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: 553 testbedrijf.nl does not exist


The actual e-mailaddress is [email protected], so it misses the 'info@'...
I guess there is something wrong with the 'from' code?
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Postby ROCLASI » Wed Apr 27, 2005 9:41 pm

It means your MTA (Mail Transfer Agent) returned a 553 code with the message "testbedrijf.nl does not exist".

I checked and that domain indeed doesn't resolve to an IP so your mailserver (MTA) can't connect to their mailserver to deliver the mail.


Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby Karel Broer » Wed Apr 27, 2005 10:15 pm

ROCLASI wrote:It means your MTA (Mail Transfer Agent) returned a 553 code with the message "testbedrijf.nl does not exist".

I checked and that domain indeed doesn't resolve to an IP so your mailserver (MTA) can't connect to their mailserver to deliver the mail.


Hope this helps.


It did! Thanks ROCLASI, I changed the e-mail adress and it works smoothly :D
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 39 guests