WeixiangYan/CodeTransOcean huggingface dataset:
Task: Send email







Python: import smtplib

def sendemail(from_addr, to_addr_list, cc_addr_list,
              subject, message,
              login, password,
              smtpserver='smtp.gmail.com:587'):
    header  = 'From: %s\n' % from_addr
    header += 'To: %s\n' % ','.join(to_addr_list)
    header += 'Cc: %s\n' % ','.join(cc_addr_list)
    header += 'Subject: %s\n\n' % subject
    message = header + message
    
    server = smtplib.SMTP(smtpserver)
    server.starttls()
    server.login(login,password)
    problems = server.sendmail(from_addr, to_addr_list, message)
    server.quit()
    return problems





Ada: with AWS.SMTP, AWS.SMTP.Client, AWS.SMTP.Authentication.Plain;
with Ada.Text_IO;
use  Ada, AWS;

procedure Sendmail is
   Status : SMTP.Status;
   Auth : aliased constant SMTP.Authentication.Plain.Credential :=
      SMTP.Authentication.Plain.Initialize ("id", "password");
   Isp : SMTP.Receiver;
begin
   Isp :=
      SMTP.Client.Initialize
        ("smtp.mail.com",
         Port       => 5025,
         Credential => Auth'Unchecked_Access);
   SMTP.Client.Send
     (Isp,
      From    => SMTP.E_Mail ("Me", "me@some.org"),
      To      => SMTP.E_Mail ("You", "you@any.org"),
      Subject => "subject",
      Message => "Here is the text",
      Status  => Status);
   if not SMTP.Is_Ok (Status) then
      Text_IO.Put_Line
        ("Can't send message :" & SMTP.Status_Message (Status));
   end if;
end Sendmail;
Task: Send email








VB: Option Explicit
Const olMailItem = 0

Sub SendMail(MsgTo As String, MsgTitle As String, MsgBody As String)
    Dim OutlookApp As Object, Msg As Object
    Set OutlookApp = CreateObject("Outlook.Application")
    Set Msg = OutlookApp.CreateItem(olMailItem)
    With Msg
        .To = MsgTo
        .Subject = MsgTitle
        .Body = MsgBody
        .Send
    End With
    Set OutlookApp = Nothing
End Sub

Sub Test()
    SendMail "somebody@somewhere", "Title", "Hello"
End Sub




Ada: with AWS.SMTP, AWS.SMTP.Client, AWS.SMTP.Authentication.Plain;
with Ada.Text_IO;
use  Ada, AWS;

procedure Sendmail is
   Status : SMTP.Status;
   Auth : aliased constant SMTP.Authentication.Plain.Credential :=
      SMTP.Authentication.Plain.Initialize ("id", "password");
   Isp : SMTP.Receiver;
begin
   Isp :=
      SMTP.Client.Initialize
        ("smtp.mail.com",
         Port       => 5025,
         Credential => Auth'Unchecked_Access);
   SMTP.Client.Send
     (Isp,
      From    => SMTP.E_Mail ("Me", "me@some.org"),
      To      => SMTP.E_Mail ("You", "you@any.org"),
      Subject => "subject",
      Message => "Here is the text",
      Status  => Status);
   if not SMTP.Is_Ok (Status) then
      Text_IO.Put_Line
        ("Can't send message :" & SMTP.Status_Message (Status));
   end if;
end Sendmail;
Task: Send email

C: #include <curl/curl.h>
#include <string.h>
#include <stdio.h>

#define from    "<sender@duniya.com>"
#define to      "<addressee@gmail.com>"
#define cc      "<info@example.org>"
 
static const char *payload_text[] = {
  "Date: Mon, 13 Jun 2018 11:30:00 +0100\r\n",
  "To: " to "\r\n",
  "From: " from " (Example User)\r\n",
  "Cc: " cc " (Another example User)\r\n",
  "Message-ID: <ecd7db36-10ab-437a-9g3a-e652b9458efd@"
  "rfcpedant.example.org>\r\n",
  "Subject: Sanding mail via C\r\n",
  "\r\n",
  "This mail is being sent by a C program.\r\n",
  "\r\n",
  "It connects to the GMail SMTP server, by far, the most popular mail program of all.\r\n",
  "Which is also probably written in C.\r\n",
  "To C or not to C..............\r\n",
  "That is the question.\r\n",
  NULL
};
 
struct upload_status {
  int lines_read;
};
 
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
{
  struct upload_status *upload_ctx = (struct upload_status *)userp;
  const char *data;
 
  if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
    return 0;
  }
 
  data = payload_text[upload_ctx->lines_read];
 
  if(data) {
    size_t len = strlen(data);
    memcpy(ptr, data, len);
    upload_ctx->lines_read++;
 
    return len;
  }
 
  return 0;
}
 
int main(void)
{
  CURL *curl;
  CURLcode res = CURLE_OK;
  struct curl_slist *recipients = NULL;
  struct upload_status upload_ctx;
 
  upload_ctx.lines_read = 0;
 
  curl = curl_easy_init();
  if(curl) {

    curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");

    curl_easy_setopt(curl, CURLOPT_URL, "smtp:

    curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
 
    curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");

    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);

    recipients = curl_slist_append(recipients, to);
    recipients = curl_slist_append(recipients, cc);
    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);

    curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
    curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

    res = curl_easy_perform(curl);

    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));

    curl_slist_free_all(recipients);

    curl_easy_cleanup(curl);
  }
 
  return (int)res;
}
Task: Send email



C#: static void Main(string[] args)
{
    

    SmtpClient SMTP = new SmtpClient("smtp.gmail.com", 587); 
    SMTP.EnableSsl = true; 
    SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
    SMTP.Credentials = new NetworkCredential("YourUserName", "YourPassword");
    MailMessage Mail = new MailMessage("yourEmail@address.com", "theirEmail@address.com");


    

    Mail.Subject = "Important Message";
    Mail.Body = "Hello over there"; 
    

    

    SMTP.Send(Mail);

    Console.WriteLine("Message Sent");
}
Task: Send email


C++: 



#include <cstdlib>
#include <iostream>
#include <Poco/Net/SMTPClientSession.h>
#include <Poco/Net/MailMessage.h>

using namespace Poco::Net;

int main (int argc, char **argv)
{
  try
    {
      MailMessage msg;

      msg.addRecipient (MailRecipient (MailRecipient::PRIMARY_RECIPIENT,
                                       "alice@example.com",
                                       "Alice Moralis"));
      msg.addRecipient (MailRecipient (MailRecipient::CC_RECIPIENT,
                                       "pat@example.com",
                                       "Patrick Kilpatrick"));
      msg.addRecipient (MailRecipient (MailRecipient::BCC_RECIPIENT,
                                       "mike@example.com",
                                       "Michael Carmichael"));

      msg.setSender ("Roy Kilroy <roy@example.com>");

      msg.setSubject ("Rosetta Code");
      msg.setContent ("Sending mail from C++ using POCO C++ Libraries");

      SMTPClientSession smtp ("mail.example.com"); 
      smtp.login ();
      smtp.sendMessage (msg);
      smtp.close ();
      std::cerr << "Sent mail successfully!" << std::endl;
    }
  catch (std::exception &e)
    {
      std::cerr << "failed to send mail: " << e.what() << std::endl;
      return EXIT_FAILURE;
    }

  return EXIT_SUCCESS;
}
Task: Send email





Java: import java.util.Properties;

import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;


public class Mail
{
 
 protected Session session;

 
 public Mail(String host)
 {
  Properties properties = new Properties();
  properties.put("mail.smtp.host", host);
  session = Session.getDefaultInstance(properties);
 }

 
 public void send(String from, String tos[], String ccs[], String subject,
        String text)
        throws MessagingException
 {
  MimeMessage message = new MimeMessage(session);
  message.setFrom(new InternetAddress(from));
  for (String to : tos)
   message.addRecipient(RecipientType.TO, new InternetAddress(to));
  for (String cc : ccs)
   message.addRecipient(RecipientType.TO, new InternetAddress(cc));
  message.setSubject(subject);
  message.setText(text);
  Transport.send(message);
 }
}
Task: Send email







Python: import smtplib

def sendemail(from_addr, to_addr_list, cc_addr_list,
              subject, message,
              login, password,
              smtpserver='smtp.gmail.com:587'):
    header  = 'From: %s\n' % from_addr
    header += 'To: %s\n' % ','.join(to_addr_list)
    header += 'Cc: %s\n' % ','.join(cc_addr_list)
    header += 'Subject: %s\n\n' % subject
    message = header + message
    
    server = smtplib.SMTP(smtpserver)
    server.starttls()
    server.login(login,password)
    problems = server.sendmail(from_addr, to_addr_list, message)
    server.quit()
    return problems
Task: Send email








VB: Option Explicit
Const olMailItem = 0

Sub SendMail(MsgTo As String, MsgTitle As String, MsgBody As String)
    Dim OutlookApp As Object, Msg As Object
    Set OutlookApp = CreateObject("Outlook.Application")
    Set Msg = OutlookApp.CreateItem(olMailItem)
    With Msg
        .To = MsgTo
        .Subject = MsgTitle
        .Body = MsgBody
        .Send
    End With
    Set OutlookApp = Nothing
End Sub

Sub Test()
    SendMail "somebody@somewhere", "Title", "Hello"
End Sub
Task: Send email




Go: package main

import (
	"bufio"
	"bytes"
	"errors"
	"flag"
	"fmt"
	"io/ioutil"
	"net/smtp"
	"os"
	"strings"
)

type Message struct {
	From    string
	To      []string
	Cc      []string
	Subject string
	Content string
}

func (m Message) Bytes() (r []byte) {
	to := strings.Join(m.To, ",")
	cc := strings.Join(m.Cc, ",")

	r = append(r, []byte("From: "+m.From+"\n")...)
	r = append(r, []byte("To: "+to+"\n")...)
	r = append(r, []byte("Cc: "+cc+"\n")...)
	r = append(r, []byte("Subject: "+m.Subject+"\n\n")...)
	r = append(r, []byte(m.Content)...)

	return
}

func (m Message) Send(host string, port int, user, pass string) (err error) {
	err = check(host, user, pass)
	if err != nil {
		return
	}

	err = smtp.SendMail(fmt.Sprintf("%v:%v", host, port),
		smtp.PlainAuth("", user, pass, host),
		m.From,
		m.To,
		m.Bytes(),
	)

	return
}

func check(host, user, pass string) error {
	if host == "" {
		return errors.New("Bad host")
	}
	if user == "" {
		return errors.New("Bad username")
	}
	if pass == "" {
		return errors.New("Bad password")
	}

	return nil
}

func main() {
	var flags struct {
		host string
		port int
		user string
		pass string
	}
	flag.StringVar(&flags.host, "host", "", "SMTP server to connect to")
	flag.IntVar(&flags.port, "port", 587, "Port to connect to SMTP server on")
	flag.StringVar(&flags.user, "user", "", "Username to authenticate with")
	flag.StringVar(&flags.pass, "pass", "", "Password to authenticate with")
	flag.Parse()

	err := check(flags.host, flags.user, flags.pass)
	if err != nil {
		flag.Usage()
		os.Exit(1)
	}

	bufin := bufio.NewReader(os.Stdin)

	fmt.Printf("From: ")
	from, err := bufin.ReadString('\n')
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		os.Exit(1)
	}
	from = strings.Trim(from, " \t\n\r")

	var to []string
	for {
		fmt.Printf("To (Blank to finish): ")
		tmp, err := bufin.ReadString('\n')
		if err != nil {
			fmt.Printf("Error: %v\n", err)
			os.Exit(1)
		}
		tmp = strings.Trim(tmp, " \t\n\r")

		if tmp == "" {
			break
		}

		to = append(to, tmp)
	}

	var cc []string
	for {
		fmt.Printf("Cc (Blank to finish): ")
		tmp, err := bufin.ReadString('\n')
		if err != nil {
			fmt.Printf("Error: %v\n", err)
			os.Exit(1)
		}
		tmp = strings.Trim(tmp, " \t\n\r")

		if tmp == "" {
			break
		}

		cc = append(cc, tmp)
	}

	fmt.Printf("Subject: ")
	subject, err := bufin.ReadString('\n')
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		os.Exit(1)
	}
	subject = strings.Trim(subject, " \t\n\r")

	fmt.Printf("Content (Until EOF):\n")
	content, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		os.Exit(1)
	}
	content = bytes.Trim(content, " \t\n\r")

	m := Message{
		From:    from,
		To:      to,
		Cc:      cc,
		Subject: subject,
		Content: string(content),
	}

	fmt.Printf("\nSending message...\n")
	err = m.Send(flags.host, flags.port, flags.user, flags.pass)
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		os.Exit(1)
	}

	fmt.Printf("Message sent.\n")
}
Task: Send email



C#: static void Main(string[] args)
{
    

    SmtpClient SMTP = new SmtpClient("smtp.gmail.com", 587); 
    SMTP.EnableSsl = true; 
    SMTP.DeliveryMethod = SmtpDeliveryMethod.Network;
    SMTP.Credentials = new NetworkCredential("YourUserName", "YourPassword");
    MailMessage Mail = new MailMessage("yourEmail@address.com", "theirEmail@address.com");


    

    Mail.Subject = "Important Message";
    Mail.Body = "Hello over there"; 
    

    

    SMTP.Send(Mail);

    Console.WriteLine("Message Sent");
}








Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email


C++: 



#include <cstdlib>
#include <iostream>
#include <Poco/Net/SMTPClientSession.h>
#include <Poco/Net/MailMessage.h>

using namespace Poco::Net;

int main (int argc, char **argv)
{
  try
    {
      MailMessage msg;

      msg.addRecipient (MailRecipient (MailRecipient::PRIMARY_RECIPIENT,
                                       "alice@example.com",
                                       "Alice Moralis"));
      msg.addRecipient (MailRecipient (MailRecipient::CC_RECIPIENT,
                                       "pat@example.com",
                                       "Patrick Kilpatrick"));
      msg.addRecipient (MailRecipient (MailRecipient::BCC_RECIPIENT,
                                       "mike@example.com",
                                       "Michael Carmichael"));

      msg.setSender ("Roy Kilroy <roy@example.com>");

      msg.setSubject ("Rosetta Code");
      msg.setContent ("Sending mail from C++ using POCO C++ Libraries");

      SMTPClientSession smtp ("mail.example.com"); 
      smtp.login ();
      smtp.sendMessage (msg);
      smtp.close ();
      std::cerr << "Sent mail successfully!" << std::endl;
    }
  catch (std::exception &e)
    {
      std::cerr << "failed to send mail: " << e.what() << std::endl;
      return EXIT_FAILURE;
    }

  return EXIT_SUCCESS;
}









Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email

C: #include <curl/curl.h>
#include <string.h>
#include <stdio.h>

#define from    "<sender@duniya.com>"
#define to      "<addressee@gmail.com>"
#define cc      "<info@example.org>"
 
static const char *payload_text[] = {
  "Date: Mon, 13 Jun 2018 11:30:00 +0100\r\n",
  "To: " to "\r\n",
  "From: " from " (Example User)\r\n",
  "Cc: " cc " (Another example User)\r\n",
  "Message-ID: <ecd7db36-10ab-437a-9g3a-e652b9458efd@"
  "rfcpedant.example.org>\r\n",
  "Subject: Sanding mail via C\r\n",
  "\r\n",
  "This mail is being sent by a C program.\r\n",
  "\r\n",
  "It connects to the GMail SMTP server, by far, the most popular mail program of all.\r\n",
  "Which is also probably written in C.\r\n",
  "To C or not to C..............\r\n",
  "That is the question.\r\n",
  NULL
};
 
struct upload_status {
  int lines_read;
};
 
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
{
  struct upload_status *upload_ctx = (struct upload_status *)userp;
  const char *data;
 
  if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
    return 0;
  }
 
  data = payload_text[upload_ctx->lines_read];
 
  if(data) {
    size_t len = strlen(data);
    memcpy(ptr, data, len);
    upload_ctx->lines_read++;
 
    return len;
  }
 
  return 0;
}
 
int main(void)
{
  CURL *curl;
  CURLcode res = CURLE_OK;
  struct curl_slist *recipients = NULL;
  struct upload_status upload_ctx;
 
  upload_ctx.lines_read = 0;
 
  curl = curl_easy_init();
  if(curl) {

    curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
    curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");

    curl_easy_setopt(curl, CURLOPT_URL, "smtp:

    curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
 
    curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem");

    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);

    recipients = curl_slist_append(recipients, to);
    recipients = curl_slist_append(recipients, cc);
    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);

    curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
    curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

    res = curl_easy_perform(curl);

    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));

    curl_slist_free_all(recipients);

    curl_easy_cleanup(curl);
  }
 
  return (int)res;
}










Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email





Java: import java.util.Properties;

import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;


public class Mail
{
 
 protected Session session;

 
 public Mail(String host)
 {
  Properties properties = new Properties();
  properties.put("mail.smtp.host", host);
  session = Session.getDefaultInstance(properties);
 }

 
 public void send(String from, String tos[], String ccs[], String subject,
        String text)
        throws MessagingException
 {
  MimeMessage message = new MimeMessage(session);
  message.setFrom(new InternetAddress(from));
  for (String to : tos)
   message.addRecipient(RecipientType.TO, new InternetAddress(to));
  for (String cc : ccs)
   message.addRecipient(RecipientType.TO, new InternetAddress(cc));
  message.setSubject(subject);
  message.setText(text);
  Transport.send(message);
 }
}






Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email







Python: import smtplib

def sendemail(from_addr, to_addr_list, cc_addr_list,
              subject, message,
              login, password,
              smtpserver='smtp.gmail.com:587'):
    header  = 'From: %s\n' % from_addr
    header += 'To: %s\n' % ','.join(to_addr_list)
    header += 'Cc: %s\n' % ','.join(cc_addr_list)
    header += 'Subject: %s\n\n' % subject
    message = header + message
    
    server = smtplib.SMTP(smtpserver)
    server.starttls()
    server.login(login,password)
    problems = server.sendmail(from_addr, to_addr_list, message)
    server.quit()
    return problems




Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email








VB: Option Explicit
Const olMailItem = 0

Sub SendMail(MsgTo As String, MsgTitle As String, MsgBody As String)
    Dim OutlookApp As Object, Msg As Object
    Set OutlookApp = CreateObject("Outlook.Application")
    Set Msg = OutlookApp.CreateItem(olMailItem)
    With Msg
        .To = MsgTo
        .Subject = MsgTitle
        .Body = MsgBody
        .Send
    End With
    Set OutlookApp = Nothing
End Sub

Sub Test()
    SendMail "somebody@somewhere", "Title", "Hello"
End Sub



Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email






PHP: mail('hello@world.net', 'My Subject', "A Message!", "From: my@address.com");





Fortran: program sendmail
    use ifcom
    use msoutl
    implicit none
    integer(4) :: app, status, msg
    
    call cominitialize(status)
    call comcreateobject("Outlook.Application", app, status)
    msg = $Application_CreateItem(app, olMailItem, status)
    call $MailItem_SetTo(msg, "somebody@somewhere", status)
    call $MailItem_SetSubject(msg, "Title", status)
    call $MailItem_SetBody(msg, "Hello", status)
    call $MailItem_Send(msg, status)
    call $Application_Quit(app, status)
    call comuninitialize()
end program
Task: Send email






PHP: mail('hello@world.net', 'My Subject', "A Message!", "From: my@address.com");






Ada: with AWS.SMTP, AWS.SMTP.Client, AWS.SMTP.Authentication.Plain;
with Ada.Text_IO;
use  Ada, AWS;

procedure Sendmail is
   Status : SMTP.Status;
   Auth : aliased constant SMTP.Authentication.Plain.Credential :=
      SMTP.Authentication.Plain.Initialize ("id", "password");
   Isp : SMTP.Receiver;
begin
   Isp :=
      SMTP.Client.Initialize
        ("smtp.mail.com",
         Port       => 5025,
         Credential => Auth'Unchecked_Access);
   SMTP.Client.Send
     (Isp,
      From    => SMTP.E_Mail ("Me", "me@some.org"),
      To      => SMTP.E_Mail ("You", "you@any.org"),
      Subject => "subject",
      Message => "Here is the text",
      Status  => Status);
   if not SMTP.Is_Ok (Status) then
      Text_IO.Put_Line
        ("Can't send message :" & SMTP.Status_Message (Status));
   end if;
end Sendmail;
Task: Send email






PHP: mail('hello@world.net', 'My Subject', "A Message!", "From: my@address.com");