Posts: 129
Threads: 38
Joined: May 2006
I just found this wonderful email function, never knew it existed, thank youuuuuuuuu!
Now how do I run this dialog box from QM
See attached picture. And also set it as default automatically?
Attached Files
Image(s)
Posts: 12,073
Threads: 140
Joined: Dec 2002
Although it is private function (called when you click Accounts in Send Email Message dialog), it will not be removed in the future, and it is safe to use it in macros.
Also read "Email help" macro.
Default email account is specified in registry key Software\Microsoft\Internet Account Manager, in HKEY_CURRENT_USER. Sorry, I don't remember what value must be changed. You'll see it in registry editor.
Posts: 129
Threads: 38
Joined: May 2006
Found it!
One of the many features I never knew existed. So much faster and easier to send email now.
Thanks so much!
Posts: 129
Threads: 38
Joined: May 2006
Can you use variables in SendMail function? Like the email address, subject and message?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Variables can be used in all functions, with few exceptions (declarations, case).
Posts: 129
Threads: 38
Joined: May 2006
Got them figured out thank you
hock:
Posts: 129
Threads: 38
Joined: May 2006
Dir d; str sPath
str Sbj="My Subject
str Msg="My Message
str x="c:\smithdr\200609*.txt"
str y z
foreach(d x FE_Dir 0x4)
sPath=d.FileName(1)
y.from(y sPath "[;]"); err
z.from("''" y "''")
z.findreplace(";" "")
out z
SendMail "[email protected] " Sbj Msg 0 z "" "" "" "" "Denise"
As you can see, I used variables on subject, message and attachment. The code only works without the attachment.
The attachment string looks like this using out command:
"c:\smithdr\20060901.txt[]c:\smithdr\20060903.txt[]c:\smithdr\20060904.txt[]"
If I copy and paste from the debugger window it works
hock:
Posts: 12,073
Threads: 140
Joined: Dec 2002
Attachment files must be delimited by new lines, not []. When you use [] in a quoted string, it is replaced to new line. And whole string must not be enclosed in ". The example in the SendMail documentation shows how the string could look in the editor.
SendMail ... "file1[]file2"
Posts: 129
Threads: 38
Joined: May 2006
Use escape sequence [91] instead of [. Or, even easier, 2 strings: "[" "]".
Problem Fixed :lol:
Posts: 12
Threads: 2
Joined: Nov 2006
Few questions about SendMail function:
1. Are the sent email saved someplace? A log or a record?
2. Also, is there a way to check if it was sent?
Posts: 12,073
Threads: 140
Joined: Dec 2002
If sending mail fails, SendMail generates error.
SendMail ...
err
,out "failed"
By default, sent messages are not saved. To save, use SendMail flag 0x800 (will save in "$my qm$\SmtpMail"), or instead of SendMail use functions of SmtpMail class.
SmtpMail mail
mail.AddMessage(...)
mail.SetSaveFolder(...)
mail.Save()
mail.Send()
Posts: 12
Threads: 2
Joined: Nov 2006
Dir d; xAttach
foreach(d "$my qm$\*.dat" FE_Dir 0x4)
xPath=d.FileName(1)
xAttach.from("''" xPath "''")
SendMail "[email protected] " "Files" "Attached" 0 xAttach "" "" "" "" "QM"
out xAttach
The above example generates an error:
"Error (RT) in SendArchive: SendMail: cannot add attachment "C:\Documents and Settings\Dad\My Documents\My QM\drsmith1024.dat"
Posts: 12,073
Threads: 140
Joined: Dec 2002
Delete ,xAttach.from("''" xPath "''")
Use this to send multiple messages
Dir d; str xPath
foreach (d "$my qm$\*.dat" FE_Dir 0x4)
, xPath=d.FileName(1)
, SendMail "[email protected] " "Files" "Attached" 0 xPath "" "" "" "" "QM"
or this to send single message with all files
Dir d; str xAttach
foreach (d "$my qm$\*.dat" FE_Dir 0x4)
, xPath=d.FileName(1)
, xAttach.from(xAttach xPath "[]")
out xAttach
SendMail "[email protected] " "Files" "Attached" 0 xAttach "" "" "" "" "QM"
Posts: 12
Threads: 2
Joined: Nov 2006
Posts: 2
Threads: 0
Joined: Jun 2008
Hi - regarding sendmail
i.e.
SendMail "
[email protected] " "subject" "text"
My question is what is the correct syntax to embedd an integer type variable as part of the subject?
Hope you can help
Posts: 12,073
Threads: 140
Joined: Dec 2002
int test=7
str sub
sub.format("subject %i" test)
SendMail "
[email protected] " sub "text"
Posts: 2
Threads: 0
Joined: Jun 2008
works a treat thanks hugely
hock:
Posts: 576
Threads: 97
Joined: Aug 2007
Having some problems with mail.
It says this in a message... "Some settings are missing for this email account:"
Any idea what that could mean? I have everything filled out...
Posts: 576
Threads: 97
Joined: Aug 2007
ok i dont get that message anymore but now i get this...
Error (RT) in "Macro6 /0"oMacro6: SendMail: [Error: Connection failure] (0x4)
Server response:
Posts: 12,073
Threads: 140
Joined: Dec 2002
Can you send email from that account in Outlook Express? If yes, you only need to enter password in the QM email account dialog.
Of course QM email functions are not as smart as email programs. With some email accounts don't work. Works with most.
Posts: 576
Threads: 97
Joined: Aug 2007
nope i just tryed...doesnt work in outlook express either...no idea why any idea?
Posts: 82
Threads: 29
Joined: Jun 2008
im getting the same thing as QM_Expert
Error (RT) in "Function4 /305"oFunction4: SendMail: [Error: Connection failure] (0x4)
Server response:
can anyone help me out
Posts: 12,073
Threads: 140
Joined: Dec 2002
Maybe you need newer QM version.
Posts: 82
Threads: 29
Joined: Jun 2008
i have the newest one, im using that is it setup right?
;smtp_server smtp.gmail.com
;smtp_port 465
;smtp_user chevyman
;smtp_password default
;smtp_auth 2
;smtp_secure 1
;smtp_timeout 60
;smtp_email
[email protected]
;smtp_displayname "chevy man"
;smtp_replyto
[email protected]
int test=7
str sub
sub.format("subject %i" test)
SendMail "
[email protected] " sub "text"
Posts: 12,073
Threads: 140
Joined: Dec 2002
No. Your macro uses default account settings, not what is in your macro. To insert correct code, open 'Send email message' dialog, select gmail accout (create if does not exist), check Var, click OK.
Posts: 82
Threads: 29
Joined: Jun 2008
how do i create or open it?
Posts: 12,073
Threads: 140
Joined: Dec 2002
The dialog is in the floating toolbar.
Posts: 82
Threads: 29
Joined: Jun 2008
ok i still get this
Error (RT) in "Function5 /0"oFunction5: SendMail: [Error: Connection failure] (0x4)
Server response:
do i have to edit the QM EMail Settings, fill in all thei nfo there too? do you think you could show a screen shot with the info filled in, but not the real info?
Posts: 12,073
Threads: 140
Joined: Dec 2002
If you don't have gmail account settings, easier is to change the code.
_s=
;smtp_server smtp.gmail.com
;smtp_port 465
;smtp_user chevyman
;smtp_password default
;smtp_auth 2
;smtp_secure 1
;smtp_timeout 60
;smtp_email
[email protected]
;smtp_displayname "chevy man"
;smtp_replyto
[email protected]
int test=7
str sub
sub.format("subject %i" test)
SendMail "
[email protected] " sub "text" 0 "" "" "" "" "" _s
To see what fails, add flag 0x80000.
...
SendMail "
[email protected] " sub "text" 0x80000 "" "" "" "" "" _s
run "$my qm$\smtp_log.txt"
Posts: 82
Threads: 29
Joined: Jun 2008
ok i filled all the info in correctly i ran it and got
Error (RT) in "Function5 /305"oFunction5: SendMail: some email account settings missing