Sending emails
16 posts
• Page 1 of 2 • 1, 2
Sending emails
Hello Brian, Good morning !
Could you give me a help about send emails ? Where can I read and/or get an example about it? I already have a contact form (mild server page). After I will send messages from within a client file.
Thanks,
Marco Gantois
Could you give me a help about send emails ? Where can I read and/or get an example about it? I already have a contact form (mild server page). After I will send messages from within a client file.
Thanks,
Marco Gantois
- Gantois
- Posts: 89
- Joined: Thu Apr 17, 2014 9:44 am
Re: Sending emails
Hi Marco,
There is an example in our Dyalog DotNet Interface guide about using .NET to send an email.
The example uses system.web.mail, but Microsoft now recommend that a system.net.mail is used instead.
Regards,
Vince
There is an example in our Dyalog DotNet Interface guide about using .NET to send an email.
The example uses system.web.mail, but Microsoft now recommend that a system.net.mail is used instead.
Regards,
Vince
- Vince|Dyalog
- Posts: 432
- Joined: Wed Oct 01, 2008 9:39 am
Re: Sending emails
Hi Vince,
Thanks for you reply. I'll study,
Marco
Thanks for you reply. I'll study,
Marco
- Gantois
- Posts: 89
- Joined: Thu Apr 17, 2014 9:44 am
Re: Sending emails
Hi Vince!
Returning to this subject, I have tryed sending email using the .Net Interface Guide example as following, but without success. What is my mistake? Is it necessary some configuration in my computer before ? I intend to use it in a website (miserver and component files).
Could You help me again?
⎕USING←'System.Web.Mail,System.Web.dll'
m←⎕NEW MailMessage
m.From←'marcogantoisnotospam@hot-mail.com'
m.To←'gutao1234notospam@g-mail.com'
m.Subject←'order'
SmtpMail.Send m
The message error is:
EXCEPTION: the configuration value "SendUsing" is invalid.
Thanks,
Marco Gantois
Returning to this subject, I have tryed sending email using the .Net Interface Guide example as following, but without success. What is my mistake? Is it necessary some configuration in my computer before ? I intend to use it in a website (miserver and component files).
Could You help me again?
⎕USING←'System.Web.Mail,System.Web.dll'
m←⎕NEW MailMessage
m.From←'marcogantoisnotospam@hot-mail.com'
m.To←'gutao1234notospam@g-mail.com'
m.Subject←'order'
SmtpMail.Send m
The message error is:
EXCEPTION: the configuration value "SendUsing" is invalid.
Thanks,
Marco Gantois
- Gantois
- Posts: 89
- Joined: Thu Apr 17, 2014 9:44 am
Re: Sending emails
Hi Vince,
About the above case (last repply)
A) The exception was:
⎕exception
System.Web.HttpException: O valor de configuração "SendUsing" é inválido.
---> System.Reflection.TargetInvocationException: Uma exceção foi acionada pelo destino de uma chamada. ---> System.Runti
--- Fim do rastreamento de pilha de exceções internas ---
em System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] by
em System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] provi
em System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- Fim do rastreamento de pilha de exceções internas ---
em System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
em System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
em System.Web.Mail.SmtpMail.Send(MailMessage message)
me.InteropServices.COMException (0x80040220): O valor de configuração "SendUsing" é inválido.
refModifiers, Int32 culture, String[] namedParameters)
dedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
B) I have tried changing from: ⎕USING←'System.Web.Mail,System.Web.dll'
to ⎕USING←'System.Net.Mail,System.Net.dll'
⎕USING←'System.Net.Mail,System.Net.dll'
m.From←'marconotospamgantois@hot-mai.com'
m.To←'gutaonotospam1234@g-mail.com'
m.Subject←'order'
m.Body←'Send me 100 copies of Dyalog APL now'
SmtpMail.Send m
VALUE ERROR
SmtpMail.Send m
∧
Thanks,
Marco
About the above case (last repply)
A) The exception was:
⎕exception
System.Web.HttpException: O valor de configuração "SendUsing" é inválido.
---> System.Reflection.TargetInvocationException: Uma exceção foi acionada pelo destino de uma chamada. ---> System.Runti
--- Fim do rastreamento de pilha de exceções internas ---
em System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] by
em System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] provi
em System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
--- Fim do rastreamento de pilha de exceções internas ---
em System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args)
em System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMessage message)
em System.Web.Mail.SmtpMail.Send(MailMessage message)
me.InteropServices.COMException (0x80040220): O valor de configuração "SendUsing" é inválido.
refModifiers, Int32 culture, String[] namedParameters)
dedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
B) I have tried changing from: ⎕USING←'System.Web.Mail,System.Web.dll'
to ⎕USING←'System.Net.Mail,System.Net.dll'
⎕USING←'System.Net.Mail,System.Net.dll'
m.From←'marconotospamgantois@hot-mai.com'
m.To←'gutaonotospam1234@g-mail.com'
m.Subject←'order'
m.Body←'Send me 100 copies of Dyalog APL now'
SmtpMail.Send m
VALUE ERROR
SmtpMail.Send m
∧
Thanks,
Marco
- Gantois
- Posts: 89
- Joined: Thu Apr 17, 2014 9:44 am
Re: Sending emails
Help - I'm having trouble sending emails from my Mipage too :-(
This is what I have written as part of my Callback function:
⎕USING←'System.Web.Mail,System.Web.dll'
⍝ OR ? ⎕USING←'System..Mail,System.Web.dll' (this did not work at all, it returned a value error for MailMessage on the next line)
m←⎕NEW MailMessage
m.Subject←'order'
m.Body←'send me 100 copies'
m.From←'annabelnotospam@s-k-y.com'
m.To←'jinnynotospam@s-k-y.com'
SmtpMail.Send m
It runs through to the last line where this occurs:
*** MiServer Debug ***
EXCEPTION
CallbackFn[38] SmtpMail.Send m
∧
It also seems to me that something must be missing as I could be sending emails from any email address as I have not entered a user password?
Many thanks, Jinny
This is what I have written as part of my Callback function:
⎕USING←'System.Web.Mail,System.Web.dll'
⍝ OR ? ⎕USING←'System..Mail,System.Web.dll' (this did not work at all, it returned a value error for MailMessage on the next line)
m←⎕NEW MailMessage
m.Subject←'order'
m.Body←'send me 100 copies'
m.From←'annabelnotospam@s-k-y.com'
m.To←'jinnynotospam@s-k-y.com'
SmtpMail.Send m
It runs through to the last line where this occurs:
*** MiServer Debug ***
EXCEPTION
CallbackFn[38] SmtpMail.Send m
∧
It also seems to me that something must be missing as I could be sending emails from any email address as I have not entered a user password?
Many thanks, Jinny
- Jinny
- Posts: 31
- Joined: Sun Jul 01, 2018 10:15 am
Re: Sending emails
Hi Jinny and Marco,
Marco, I am sorry for not answering your last posts on this thread last time! Please email me a reminder at support if that happens again.
Jinny, I have created a function named trynetmail for this and the following code works:
By the way, I would advise against putting your real email address (and that of Annabel) in a public forum. I think Spammers get such email addresses and spam them, or use them as fake email addresses for sending SPAM.
I have edited the posts in this thread to disguise the email addresses.
Regards,
Vince
Marco, I am sorry for not answering your last posts on this thread last time! Please email me a reminder at support if that happens again.
Jinny, I have created a function named trynetmail for this and the following code works:
trynetmail;⎕USING;⎕IO;⎕ML;m;ma;client
⎕USING←,⊂''
⎕USING,←⊂'System.Net.Mail,System.dll'
⎕USING,←⊂'System'
⎕ML←⎕IO←1
m←⎕NEW MailMessage
ma←⎕NEW MailAddress(⊂'support@dyalog.com')
m.From←ma
ma←⎕NEW MailAddress(⊂'support@dyalog.com')
m.To.Add ma
m.Subject←⊂'Hello world from Dyalog'
m.Body←⊂'This is my test email'
client←⎕NEW SmtpClient(⊂'smtp.yourSMTPServer.com')
client.Send m
By the way, I would advise against putting your real email address (and that of Annabel) in a public forum. I think Spammers get such email addresses and spam them, or use them as fake email addresses for sending SPAM.
I have edited the posts in this thread to disguise the email addresses.
Regards,
Vince
- Vince|Dyalog
- Posts: 432
- Joined: Wed Oct 01, 2008 9:39 am
Re: Sending emails
Hi Vince,
Many thanks for the advice, it runs through fine till the last line and then:
*** MiServer Debug ***
EXCEPTION
CallbackFn[53] client.Send m
∧
I'm wondering whether I need to declare the sender email address anywhere and provide the password? Help!
It was very kind of you to edit my email addresses to avoid my being inundated with Spam - thank you, Jinny
Many thanks for the advice, it runs through fine till the last line and then:
*** MiServer Debug ***
EXCEPTION
CallbackFn[53] client.Send m
∧
I'm wondering whether I need to declare the sender email address anywhere and provide the password? Help!
It was very kind of you to edit my email addresses to avoid my being inundated with Spam - thank you, Jinny
- Jinny
- Posts: 31
- Joined: Sun Jul 01, 2018 10:15 am
Re: Sending emails
Hi Jinny,
When you get a .NET Exception, try to see if there is anything interesting in
⎕Exception
and
⎕exception.InnerException.
You can read more about the SmtpClient class here:
https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient.-ctor?view=netframework-4.6.1
In the example they have there, they do say something about Credentials.
Regards,
Vince
When you get a .NET Exception, try to see if there is anything interesting in
⎕Exception
and
⎕exception.InnerException.
You can read more about the SmtpClient class here:
https://docs.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient.-ctor?view=netframework-4.6.1
In the example they have there, they do say something about Credentials.
Regards,
Vince
- Vince|Dyalog
- Posts: 432
- Joined: Wed Oct 01, 2008 9:39 am
Re: Sending emails
Hi there,
I never did manage to send emails from my APL code. I shelved it as I figured that it might be blocked because I was working on an NHS computer.
However, now I have reached the point where I have to return to the problem. I've moved all my APL to a different computer which doesn't have organisation-imposed blocks.
It looks as though nodemail may be the easiest way to send emails from my code? Can I use this with APL? I'm a bit out of my depth about how they would relate, would I simply enclose nodemail commands in an 'Add _.script ScriptFollows' section?
Many thanks for any advice,
Jinny
I never did manage to send emails from my APL code. I shelved it as I figured that it might be blocked because I was working on an NHS computer.
However, now I have reached the point where I have to return to the problem. I've moved all my APL to a different computer which doesn't have organisation-imposed blocks.
It looks as though nodemail may be the easiest way to send emails from my code? Can I use this with APL? I'm a bit out of my depth about how they would relate, would I simply enclose nodemail commands in an 'Add _.script ScriptFollows' section?
Many thanks for any advice,
Jinny
- Jinny
- Posts: 31
- Joined: Sun Jul 01, 2018 10:15 am
16 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group