Page 1 of 1 1
Topic Options
#205869 - 2012-10-01 12:25 PM UDF Sendmail Query
GeorgeLittle Offline
Fresh Scripter

Registered: 2011-02-08
Posts: 47
Loc: UK
Hi,

Here is my call of the UDF Sendmail

sendmail('george.little@test.lobi.com,'test@test.lobi.com','Testing 1-2-3','Goats',"Text",'smtpmail.lobi.com,1)

So I have two questions the call completes without showing any errors is this Syntax correct to send to a open SMTP server ?

Can I add a value held in a variable to the email eg $cat into the subject ?

Top
#205870 - 2012-10-01 12:50 PM Re: UDF Sendmail Query [Re: GeorgeLittle]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You did include the UDF itself in your code right?

@ is a reserved character in kix so you may need to double up on it or use SetOption("NoMarcosInStrings", "On") at the top of your script.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205872 - 2012-10-01 01:56 PM Re: UDF Sendmail Query [Re: Mart]
GeorgeLittle Offline
Fresh Scripter

Registered: 2011-02-08
Posts: 47
Loc: UK
Yes I included the UDF and it has the no strings in the UDF \:D
Top
#205873 - 2012-10-01 02:23 PM Re: UDF Sendmail Query [Re: GeorgeLittle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: GeorgeLittle
sendmail('george.little@test.lobi.com,'test@test.lobi.com','Testing 1-2-3','Goats',"Text",'smtpmail.lobi.com,1)
Counting quotes comes up odd.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#205874 - 2012-10-01 02:24 PM Re: UDF Sendmail Query [Re: GeorgeLittle]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
There is more than one sendmail UDF here... is this one the one you are using?

Sendmail -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=201907#Post201907

If so,

You don't have to double up on @ or turn or nomacros, it takes care of it. (Although turning on NoMacrosinstrings is a good practice)

You can use a variable in any of the parameters of the function, ie sendmail($to_name,$from_name,"Date: " + @date)

For this particular sendmail function your syntax would be:
 Code:
$RC=sendmail('george.little@test.lobi.com,'test@test.lobi.com','Testing 1-2-3','Goats',"Text",,'smtpmail.lobi.com')
? @serror


You were putting the smtp server where the attachment goes. So adding a comma will allow you to omit the attachment and put the server in the correct location.

Top
#205875 - 2012-10-01 02:32 PM Re: UDF Sendmail Query [Re: Allen]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Allen
There is more than one sendmail UDF here... is this one the one you are using?

Sendmail -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=201907#Post201907

If so,

You don't have to double up on @ or turn or nomacros, it takes care of it. (Although turning on NoMacrosinstrings is a good practice)

You can use a variable in any of the parameters of the function, ie sendmail($to_name,$from_name,"Date: " + @date)

For this particular sendmail function your syntax would be:

$RC=sendmail('george.little@test.lobi.com,'test@test.lobi.com','Testing 1-2-3','Goats',"Text",,'smtpmail.lobi.com')


You were putting the smtp server where the attachment goes. So adding a comma will allow you to omit the attachment and put the server in the correct location.
The quoting is still odd.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#205876 - 2012-10-01 02:39 PM Re: UDF Sendmail Query [Re: Les]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Thanks Les, I didn't even look at that.

 Code:
$RC=sendmail('george.little@test.lobi.com','test@test.lobi.com','Testing 1-2-3','Goats','Text',,'smtpmail.lobi.com')
? @serror

Top
#205878 - 2012-10-01 03:48 PM Re: UDF Sendmail Query [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Actually, it was "Oddly Even" in the first case before becoming downright odd in the quoting department. ;\)

George - it's always a good idea to use vars in complex function calls. This allows you to debug by displaying the variable contents prior to the call. Same idea for complex command lines passed to Run or Shell..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205880 - 2012-10-01 03:57 PM Re: UDF Sendmail Query [Re: Glenn Barnas]
GeorgeLittle Offline
Fresh Scripter

Registered: 2011-02-08
Posts: 47
Loc: UK
Thanks guys well I now get a CDO error message so thats some progress. -he server.ion error "send" (CDO.Message.1 - The transport failed to connect to t
) [-2147352567/80020009]

So have I got the authentication set to none ? or have I not got enougth commas. Sorry to ask some many newb instructions I used to use Blat

Top
#205881 - 2012-10-01 11:49 PM Re: UDF Sendmail Query [Re: GeorgeLittle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
If you like (and understand how to troubleshoot) Blat, look at the send mail service code in the script vault on this site. With it, any program can create an INI file with the message followed by the INI data. When the Kix code is called (either as needed or running continuously as a system service) all of the message files in the Mail folder are processed and sent.

I have this running on one server in my network. Any app that wants to send mail simply writes the .MSG file there. If the app or user has write access to the folder, they can send mail. That is the only non-mail server in my environment that's allowed to send mail to the SMTP gateway, further improving security.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205882 - 2012-10-02 01:04 AM Re: UDF Sendmail Query [Re: Glenn Barnas]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Glenn Barnas
Actually, it was "Oddly Even" in the first case before becoming downright odd in the quoting department. ;\)
Ja, two wrongs don't make a right.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.062 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org