
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
github.com/sendlix/go-sdk
The official Go SDK for the Sendlix email service API. This SDK provides a comprehensive interface for sending emails, managing email groups, and handling authentication with the Sendlix platform.
go get github.com/sendlix/go-sdk
package main
import (
"context"
"log"
"github.com/sendlix/go-sdk/pkg"
)
func main() {
// Create authentication with your API key
auth, err := sendlix.NewAuth("your-secret.your-key-id")
if err != nil {
log.Fatal(err)
}
// Create an email client
client, err := sendlix.NewEmailClient(auth, nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Send a simple email
response, err := client.SendEmail(context.Background(), sendlix.MailOptions{
From: sendlix.EmailAddress{Email: "sender@example.com", Name: "Sender Name"},
To: []sendlix.EmailAddress{{Email: "recipient@example.com", Name: "Recipient"}},
Subject: "Hello from Sendlix!",
Content: sendlix.MailContent{
HTML: "<h1>Hello World!</h1><p>This is a test email.</p>",
Text: "Hello World!\n\nThis is a test email.",
},
}, nil)
if err != nil {
log.Fatal(err)
}
log.Printf("Email sent! Message IDs: %v", response.MessageList)
log.Printf("Emails remaining: %d", response.EmailsLeft)
}
All API operations require authentication using an API key from your Sendlix account. The API key format is secret.keyID
:
auth, err := sendlix.NewAuth("your-secret.123456")
if err != nil {
log.Fatal(err)
}
The SDK automatically handles JWT token exchange and caching, so you don't need to manage tokens manually.
Send emails to specific recipients with full control over all parameters:
response, err := client.SendEmail(ctx, sendlix.MailOptions{
From: sendlix.EmailAddress{Email: "from@example.com", Name: "Sender Name"},
To: []sendlix.EmailAddress{{Email: "to@example.com", Name: "Recipient"}},
CC: []sendlix.EmailAddress{{Email: "cc@example.com"}},
BCC: []sendlix.EmailAddress{{Email: "bcc@example.com"}},
Subject: "Important Message",
ReplyTo: &sendlix.EmailAddress{Email: "reply@example.com"},
Content: sendlix.MailContent{
HTML: "<h1>HTML Content</h1><p>This is HTML content.</p>",
Text: "Text Content\n\nThis is plain text content.",
Tracking: true,
},
}, &sendlix.AdditionalOptions{
Category: "newsletter",
SendAt: &futureTime,
Attachments: []sendlix.Attachment{{
ContentURL: "https://example.com/document.pdf",
Filename: "document.pdf",
ContentType: "application/pdf",
}},
})
Send emails to predefined groups for bulk operations:
response, err := client.SendGroupEmail(ctx, sendlix.GroupMailData{
GroupID: "newsletter-subscribers",
From: sendlix.EmailAddress{Email: "news@example.com", Name: "Newsletter"},
Subject: "Weekly Newsletter",
Content: sendlix.MailContent{
HTML: "<h1>This Week's News</h1><p>Stay updated with our latest news.</p>",
Text: "This Week's News\n\nStay updated with our latest news.",
},
Category: "newsletter",
})
Send pre-formatted EML messages:
emlContent := []byte(`From: sender@example.com
To: recipient@example.com
Subject: Test Email
This is a test email message.`)
response, err := client.SendEMLEmail(ctx, emlContent, nil)
Manage email groups for bulk operations:
// Create a group client
groupClient, err := sendlix.NewGroupClient(auth, nil)
if err != nil {
log.Fatal(err)
}
defer groupClient.Close()
// Add emails to a group
emails := []sendlix.EmailData{
{Email: "user1@example.com", Name: "User One"},
{Email: "user2@example.com", Name: "User Two"},
}
substitutions := map[string]string{
"company": "Example Corp",
"product": "Amazing Product",
}
response, err := groupClient.InsertEmailToGroup(ctx, "my-group", emails, substitutions)
if err != nil {
log.Fatal(err)
}
// Remove an email from a group
removeResponse, err := groupClient.RemoveEmailFromGroup(ctx, "my-group", "user1@example.com")
// Check if an email exists in a group
checkResponse, err := groupClient.CheckEmailInGroup(ctx, "my-group", "user2@example.com")
if err != nil {
log.Fatal(err)
}
if checkResponse.Exists {
log.Println("Email is in the group")
}
Customize client behavior with configuration options:
config := &sendlix.ClientConfig{
ServerAddress: "api.sendlix.com:443",
UserAgent: "MyApp/1.0.0",
Insecure: false, // Only set to true for testing
}
client, err := sendlix.NewEmailClient(auth, config)
The SDK provides detailed error information:
response, err := client.SendEmail(ctx, options, nil)
if err != nil {
if strings.Contains(err.Error(), "authentication") {
log.Println("Check your API key")
} else if strings.Contains(err.Error(), "quota") {
log.Println("Email quota exceeded")
} else {
log.Printf("Email send failed: %v", err)
}
return
}
log.Printf("Email sent successfully!")
log.Printf("Message IDs: %v", response.MessageList)
log.Printf("Emails remaining: %d", response.EmailsLeft)
All operations support Go contexts for timeout and cancellation:
// Set a timeout for the operation
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
response, err := client.SendEmail(ctx, options, nil)
Close()
on clients when done to prevent resource leaksThis SDK is licensed under the Apache License 2.0. See LICENSE for details.
For support and questions:
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.