WeBWorK Main Forum

Sending email through gmail with TLS

Sending email through gmail with TLS

by Michael Shulman -
Number of replies: 2
Our school uses Gmail for our email accounts. I am trying to configure webwork to send email, but I believe that gmail's SMTP servers require a username and password login, and the mail settings in site.conf don't include anywhere to enter such data. Simply setting the smtpServer to smtp.gmail.com produces "Server error: 530 5.7.0 Must issue a STARTTLS command first." when trying to send email from webwork. Is there any way to configure webwork to log into an SMTP server to send mail through?
In reply to Michael Shulman

Re: Sending email through gmail with TLS

by Robert Mařík -

Old question, but someone could be interested.

I have gmail account switched to less secure access.

smtp server is smt.gmail.com

To send emails I had to add username and password into the /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm file.

In the lines following

sub createEmailSenderTransportSMTP {

I changed the setting into

host => $ce->{mail}->{smtpServer},
ssl => 'starttls', #$ce->{mail}->{tls_allowed}//0, ## turn off ssl security by default
port => $ce->{mail}->{smtpPort},
timeout => $ce->{mail}->{smtpTimeout},
sasl_username => 'myemail@gmail.com',
sasl_password => 'mypassword',

Here of course you have to use your username and password.

According tom some Debian Howto, 100 email per day is the limit for this access to the smtp server. The reply-to is to not the student's email, but the gmail used for sending messages. This has been mentioned in some other threads.

Hope this helps someone.

Robert

In reply to Robert Mařík

Re: Sending email through gmail with TLS

by Bernd Sing -

Hi Robert,

thanks, I did help me at the time.

I would like to mention, though, that now after upgrading to 2.18 sub createEmailSenderTransportSMTP is no longer found in the file /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm, but in the file /opt/webwork/webwork2/lib/WeBWorK/Utils.pm.

Hope that helps someone else.

Bernd