Hi all
we have an IBM i that run V7r1, and we would need to using to as SMTP Client to relay mail to Gmail; is there any way to do that with open source program ? i found some discussion in the web, but i'm not been able to understand if with V7R1 is possible to do that or not.
any suggestion or comments is welcome
Thanks in advance
Gio
Using IBM i SMTP Client to relay email to GMail
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Using IBM i SMTP Client to relay email to GMail
What do you mean by 'relay to gmail'?
Do you mean that Google is letting you use one of their servers as an outgoing SMTP server?
Or do you mean you have your own internal network, smtp, and so forth, and you want to send mail that can be sent through to Google Mail? (This, actually, doesn't require any special setup -- if it's not working, you have the mail set up wrong, or your provider does.)
Provide more detail, please.
Do you mean that Google is letting you use one of their servers as an outgoing SMTP server?
Or do you mean you have your own internal network, smtp, and so forth, and you want to send mail that can be sent through to Google Mail? (This, actually, doesn't require any special setup -- if it's not working, you have the mail set up wrong, or your provider does.)
Provide more detail, please.
Re: Using IBM i SMTP Client to relay email to GMail
We use PHP to send emails via a gmail SMTP server and have been doing so for a number of years. It works fine but did take some playing around with to get it right initially.
Re: Using IBM i SMTP Client to relay email to GMail
Hi Scott
i mean this :
i mean this :
Thanks in advanceScott Klement wrote: ↑Wed Aug 10, 2022 9:23 pm Do you mean that Google is letting you use one of their servers as an outgoing SMTP server?
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Using IBM i SMTP Client to relay email to GMail
I have not used one of Google's SMTP servers for outgoing mail. What are their requirements?
Re: Using IBM i SMTP Client to relay email to GMail
We use PHPMailer. I'll try to dig out the script we are using which should remind me of the requirements.
Re: Using IBM i SMTP Client to relay email to GMail
This is just part of the script - as far as I can see other than having to authenticate ourselves there's nothing really special there.
We may have had to make an additional entry in our DNS records but I don't recall the details. It was all spelt our by gmail.
Hope this helps.
Code: Select all
require 'PHPMailerAutoload.php';
// Create a new PHPMailer instance
$mail = new PHPMailer;
// Set PHPMailer to use the SMTP transport
$mail->isSMTP();
// Set debug to verbose
//$mail->SMTPDebug = 2;
//$mail->Debugoutput = 'html';
// Set host
$mail->SMTPAuth = true;
$mail->Host = 'tls://smtp.gmail.com:587';
$mail->Username = 'xxx@systemideveloper.com'; // SMTP account username
$mail->Password = "yyyyyyyyyyy"; // SMTP account password
// Set who the message is to be sent from
$mail->setFrom('ABC@systemideveloper.com'');
$mail->Subject = "$company - Promotion Code for RPG & DB2 Summit in Chicago";
// Set who the message is to be sent to
$mail->addAddress($email, $contact);
$mail->addCC('AnyCCPaeerson@systemideveloper.com', 'CC Person');
// Set the body and alt text
$mail->msgHTML( $html1 . $html2 );
$mail->AltBody = $text1 . $text2 ;
// send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo . "<br>";
} else {
echo "Message to: " . $contact . " with email: " . $email . " - sent!<br>";
}
$mail->clearAllRecipients();
Hope this helps.
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Using IBM i SMTP Client to relay email to GMail
Ok, so the requirements appear to be support for STARTTLS on port 587 and SASL with your login.
Will Jon's PHP option work for you?
In Node.js you could use Nodemailer, that should work fine.
Will Jon's PHP option work for you?
In Node.js you could use Nodemailer, that should work fine.
Re: Using IBM i SMTP Client to relay email to GMail
Scott and jonboy many thanks
unfortunatly i don't know PHP .. so it is hard for me follow the jonboy example; i tried to search for Nodemailer and i found Scott document at https://www.scottklement.com/presentati ... BM%20i.pdf. question for Scott: if i follow your example "Example, Node Mailer" , also if i know NodeJs just a little, do you think i will able to success on sending mail via Gmail ? are there in the web other example (for IBM i) that i can follow ?
Thanks in advance
Gio
unfortunatly i don't know PHP .. so it is hard for me follow the jonboy example; i tried to search for Nodemailer and i found Scott document at https://www.scottklement.com/presentati ... BM%20i.pdf. question for Scott: if i follow your example "Example, Node Mailer" , also if i know NodeJs just a little, do you think i will able to success on sending mail via Gmail ? are there in the web other example (for IBM i) that i can follow ?
Thanks in advance
Gio
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Using IBM i SMTP Client to relay email to GMail
There isn't anything "IBM i" related about your question. Open source solutions such as PHP or Node.js work the same on all platforms. (The same is true for Python, Java, Ruby, and so forth.)
I've already mentioned that I have not set up outgoing mail through Gmail.
So I went to Google and searched "nodemailer gmail" and immediately found this:
https://nodemailer.com/usage/using-gmail/
and this
https://mailtrap.io/blog/nodemailer-gmail/
I don't know the answer to your question, and Jon knows how to do it with PHP and has shown you that solution. You can easily find other solutions by searching for it.
I've already mentioned that I have not set up outgoing mail through Gmail.
So I went to Google and searched "nodemailer gmail" and immediately found this:
https://nodemailer.com/usage/using-gmail/
and this
https://mailtrap.io/blog/nodemailer-gmail/
I don't know the answer to your question, and Jon knows how to do it with PHP and has shown you that solution. You can easily find other solutions by searching for it.