Question regarding sending automated email from HTML webpage?

Soldato
Joined
24 Feb 2004
Posts
2,713
Hi all

I was wondering if someone could point me in the right direction regarding sending automated emails.

Suppose you have webpage coded in plain HTML and there is a form on there where people would type their information in there, like email, phone, address and some other things. Now i want to generate an auto email and send it using google mail account I have. The issue is that I don't want to send just a plain email, but would like to use use some of the information in the form they filled out to generate a custom email. Like lets say their name to address the email specifically to them and also other information. The email is similar to "Business email template" So i am assuming i would need some code somewhere to achieve this functionality just not sure if this can be done with google mail sever.

would i need a dedicated email server if this is not possible to do via google mail. I don't expect to have high volumes of email, maybe 20 a day max.

any advice on how to implement this would be appreciated and also what coding language would be best to use. Last time i though about this stuff people were using ASP 3.0 and that was many many years ago.

Thanks
 
Man of Honour
Joined
30 Oct 2003
Posts
13,257
Location
Essex
From an infrastructure side of things you can do this via smtp folders in iis, not sure if google will let you relay though. Info on this setup can be found here:

https://blogs.technet.microsoft.com/lalitbisht/2017/05/19/smtp-folders-in-iis-6/

You effectively drop en email into the folder and let iis do its thing. In terms of the code it's been a long time but I do have some demo code and form.somewhere that I can dig out.

Of course all of this depends on the current website setup. What is it hosted on?
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
You would use your google mail account purely as the email sending service. It would be more difficult to access saved templates and things in your google account.

The code of your webpage would build the whole email, including the body text. The simplest way is just to hard code the email text and fill in their name, email address, etc at appropriate points. You could also create some templates (just text files with placeholder text, like <<emailaddress>> ) then read in the file and replace the placeholders with proper info before sending.
 
Soldato
Joined
27 Mar 2003
Posts
2,708
Why not use a service like SendGrid to send the emails? They have a free tier for a limited number of emails per day (100 from memory) you can send and you should be able to have custom templates as well. That way you don't need to worry about the infrastructure and they have click tracking etc as standard.
All you do is send the email to their smtp/api server using whatever technology stack you feel most comfortable in.
 
Soldato
OP
Joined
24 Feb 2004
Posts
2,713
Thanks all for the reply really appreciate taking the time to respond. Sorry for the late reply just been so busy lately.

You would use your google mail account purely as the email sending service. It would be more difficult to access saved templates and things in your google account.

The code of your webpage would build the whole email, including the body text. The simplest way is just to hard code the email text and fill in their name, email address, etc at appropriate points. You could also create some templates (just text files with placeholder text, like <<emailaddress>> ) then read in the file and replace the placeholders with proper info before sending.

I understand the general premise. I understand how to access the information from a database that might contain various fields that contain data that might be typed in a registration form. I know how to build the template on the fly but now sure how to email this. What do you use to actually email this page to someone. Can anyone point me to piece of code example or object requires from a library that might do this?


From an infrastructure side of things you can do this via smtp folders in iis, not sure if google will let you relay though. Info on this setup can be found here:

https://blogs.technet.microsoft.com/lalitbisht/2017/05/19/smtp-folders-in-iis-6/

You effectively drop en email into the folder and let iis do its thing. In terms of the code it's been a long time but I do have some demo code and form.somewhere that I can dig out.

Of course all of this depends on the current website setup. What is it hosted on?

Any code you could provide would be much appreciated, Thank you


Why not use a service like SendGrid to send the emails? They have a free tier for a limited number of emails per day (100 from memory) you can send and you should be able to have custom templates as well. That way you don't need to worry about the infrastructure and they have click tracking etc as standard.
All you do is send the email to their smtp/api server using whatever technology stack you feel most comfortable in.

Unfortunately its not possible to pass information that people provide over the internet here in the UK to another company based over in USA or somewhere else in the world. I have been told its against Data Protections Act and would be illegal.


also what language would people recommend i use for coding this in. Back 2005-6 when i was using ASP 3.0 there was not much now its million different way to do the same thing.

Thanks again everyone.
 
Soldato
Joined
27 Mar 2003
Posts
2,708
Unfortunately its not possible to pass information that people provide over the internet here in the UK to another company based over in USA or somewhere else in the world. I have been told its against Data Protections Act and would be illegal.

If you make your users aware you using a third party service and they agree to the privacy policy then you are fine to do this. As they surely will be agreeing to some form of GDPR/Privacy Policy for you to process the information. SendGrid and other "automated" mail systems would all have an issue if it was the case that it was illegal to do this as a number of them are US based. As long as the US company being used is signed up to "Privacy Guard" which is an agreement between the EU and US then you should be fine to transfer the data between services as long as you state this somewhere in your ToS.

If you couldn't use this method then I suspect you couldn't use Google to transfer the email due to their smtp servers being in the US as well. (Unless you can guarantee that you are using UK/EU ones)

As for technology to use that is up to you. If you are familiar with Microsoft technologies then use .net 4.7/4.8 or even move up to .net core 3.0 (as that has now been released). Use whatever technology you feel most comfortable with and that will integrate with minimal effort into your existing site.
 
Back
Top Bottom